Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

What Alpha command if I have the sample VB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    What Alpha command if I have the sample VB

    Hi All Experts,

    I try to write the function the amount in word for my langquage.
    I try to search and adap from this board but not work perfectly for my local langquage. it can say the amount in word only 9,999.99 and it can say not correctly if the amount more than 10,000.00

    I have the sample VB code that can use well for my local langquage. Anybody can help me to see if the VB code and what is the Alpha V10 code is. the full structure of VB is following:

    Private Sub Command1_Click()
    Call saynum (Text1.Text)
    End Sub


    In A5V10, I have to writh the function

    Function saynum as c (text1 as N)
    -----
    -----
    End function


    or not ?
    and

    Dim digitext As String ---> Dim digitext as C ?
    Dim digit As integer ---> Dim digi as N ?


    Thanks
    Peter-th

    #2
    Re: What Alpha command if I have the sample VB

    Peter,

    What is your local language?

    Are you wanting to convert a number into text the same as writing out a Cheque?
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      Re: What Alpha command if I have the sample VB

      Originally posted by peterth View Post
      Private Sub Command1_Click()
      Call saynum (Text1.Text)
      End Sub



      Function saynum as c (text1 as N)
      -----
      -----
      End function


      or not ?
      and

      Dim digitext As String ---> Dim digitext as C ?
      Dim digit As integer ---> Dim digi as N ?


      Thanks
      Peter-th
      In the Code editor you can create create a function, or you can create a function in your script (more similar to VB). The structure is a little more open than VB, however, xBasic code can be structured fairly similar to VB without too much difference....

      If i understand you correctly...your code in xbasic would look something like the following...

      Goto the "code" tab on the control panel. Create a new "xBasic Script" and copy and paste this code to see how it works.

      Code:
      DIM vNum as n
      DIM vResults as c
      
      vNum = ui_get_number("Enter Number","Please enter a value to check if correct or not")
      
      ui_msg_box("Before Function is called","The value you are checking is:   " + str(vNum))
      
      vResults = fCalculate(vNum)
      
      
      	
      FUNCTION fCalculate as c (fNum as n)
      	
      	if fNum > 10000 then
      	    fCalculate = "Not Correct"
      	else 
      		fcalculate = "Correct"
      	end if
      	
      	ui_msg_box("Value Checked","The results are this value is...   "+ fcalculate )
      	
      End function
      Last edited by goldberg2727; 03-16-2010, 05:19 AM.
      Lee Goldberg
      Software Development and Sales
      Shore Consultants Ltd.
      [email protected]
      www.shorecon.com

      Comment


        #4
        Re: What Alpha command if I have the sample VB

        Hi Keith,

        It's thai. The structure is not same as the english.
        yes, I want it to convert a number in to text same as writing out a cheque.

        total 1,456,045.99 and say the amount in word in my langquage
        I search the sample from this board and modify itbut it can say only 9,999.99
        I have the sample code here but from VB, PHP but I don't know how to convert it into A5V10

        Thanks
        Peter-th

        Comment


          #5
          Re: What Alpha command if I have the sample VB

          I was thinking about this and I think I might have miss understood you .... is this what you are looking for?

          Code:
          DIM vStr as c
          
          vStr = str(9999999999.22,255,2,"XF")
          
          ui_msg_box("",vStr)
          Lee Goldberg
          Software Development and Sales
          Shore Consultants Ltd.
          [email protected]
          www.shorecon.com

          Comment


            #6
            Re: What Alpha command if I have the sample VB

            Go ahead and post the VB code and I will convert it for you.
            Lee Goldberg
            Software Development and Sales
            Shore Consultants Ltd.
            [email protected]
            www.shorecon.com

            Comment


              #7
              Re: What Alpha command if I have the sample VB

              Hi Lee,

              Thank you for your sample. May be we misscommunication due to my english
              My point is I want to create the function for amount in word for my langquage with Alpha Five and I have the VB code that can run in the same for amount in word but I'm not familiar with VB or PHP so I ask here for anyone can suggest if VB command and what should be in A5V10.
              The VB command in blue is VB and I need to know if what command should be in A5V10

              Thank you for more suggestion
              Peter-th

              Comment


                #8
                Re: What Alpha command if I have the sample VB

                Hi Lee,

                The following is the VB code that I want to use in A5V10 for a amount in word
                Thank you in advance if you can see what it should be code in A5V10.
                Don't worry if some word is in local langquage and is that it can say in local langquage.
                ----------------------------

                Function Convert_Num(Xvar)
                Dim Thai_number As String

                ReDim n(1 To 9) As String
                ReDim l(1 To 6) As String

                Dim ed As String
                Dim yee As String
                Dim Baht As String
                Dim Stang As String
                Dim Nodecimal As String
                Dim ntostr As String
                Dim ndec As String

                n(1) = "หนึ่ง"
                n(2) = "สอง"
                n(3) = "สาม"
                n(4) = "สี"
                n(5) = "ห้า"
                n(6) = "หก"
                n(7) = "เจ็ด"
                n(8) = "แปด"
                n(9) = "เก้า"

                l(1) = "สิบ"
                l(2) = "ร้อย"
                l(3) = "พัน"
                l(4) = "หมื่น"
                l(5) = "แสน"
                l(6) = "ล้าน"

                ed = "เอ็ด"
                yee = "ยี่"
                Baht = "บาท"
                Stang = "สตางค์"
                Nodecimal = "ถ้วน"
                Zero = "ศูนย์"



                Dim Stt As Integer
                Dim LSTR As Integer
                Dim Decp As String
                Dim nstr As String
                Dim dcstr As String
                Dim chknum As Integer
                If Xvar <> 0 Then

                ntostr = Xvar
                nstr = Trim$(ntostr)

                LSTR = Len(nstr)


                Rem Decp = Mid$(ntostr, Lstr - 2, 1)
                Rem ndec = Mid$(ntostr, Lstr - 1, 2)
                Decp = " "
                For I = 1 To Len(nstr)
                If Mid$(nstr, I, 1) = "." Then
                Decp = "."
                Exit For
                End If
                Next I

                If Decp = "." Then
                If Len(nstr) < I + 2 Then
                ndec = Mid$(nstr, I + 1, 1) + "0"
                Else
                ndec = Mid$(nstr, I + 1, 2)
                End If
                If Decp = "." Then
                nstr = Mid$(nstr, 1, I - 1)
                End If
                End If

                Dim schar As String

                LSTR = I - 1

                For b = 0 To LSTR - 1

                schar = Mid$(nstr, LSTR - b, 1)

                Select Case b

                Case 0
                If nstr = "1" Then
                Thai_number = n(1)
                Else
                If schar = "1" Then
                Thai_number = ed
                Else
                chknum = Val(schar)
                If chknum > 0 Then
                Thai_number = n(chknum)
                End If
                End If
                End If
                Case 1
                If schar <> "0" Then
                If schar = "1" Then
                Thai_number = l(1) + Thai_number
                Else
                If schar = "2" Then
                Thai_number = yee + l(1) + Thai_number
                Else
                chknum = Val(schar)
                Thai_number = n(chknum) + l(1) + Thai_number
                End If
                End If
                End If
                Case Else
                If schar <> "0" And schar <> "." Then
                chknum = Val(schar)
                Thai_number = n(chknum) + l(b) + Thai_number
                End If
                End Select

                Next b

                If Decp <> "." Or Val(ndec) = 0 Then
                Thai_number = Thai_number + Baht + Nodecimal
                Else
                Thai_number = Thai_number + Baht

                Select Case Val(ndec)
                Case 0
                Rem Thai_number = Thai_number + Baht
                Case Is < 10
                If Val(ndec) = 1 Then
                Thai_number = Thai_number + ed
                Else
                Thai_number = Thai_number + n(Val(ndec))
                End If
                Case 10
                Thai_number = Thai_number + l(1)
                Case 11
                Thai_number = Thai_number + l(1) + ed
                Case 12 To 19
                Thai_number = Thai_number + l(1) + n(Val(ndec) - 10)
                Case 20
                Thai_number = Thai_number + yee + l(1)
                Case 21 To 29
                If Val(ndec) = 21 Then
                Thai_number = Thai_number + yee + l(1) + ed
                Else
                Thai_number = Thai_number + yee + l(1) + n(Val(ndec) - 20)
                End If
                Case Else
                If Mid$(ndec, 2, 1) <> "0" Then
                Thai_number = Thai_number + n(Val(Mid$(ndec, 1, 1))) + l(1) + n(Val(Mid$(ndec, 2, 1)))
                Else
                Thai_number = Thai_number + n(Val(Mid$(ndec, 1, 1))) + l(1)
                End If
                End Select
                Thai_number = Thai_number + Stang
                End If
                Convert_Num = Thai_number
                ElseIf Xvar = 0 Then
                Convert_Num = Zero & Baht & Nodecimal
                End If

                End Function

                Comment


                  #9
                  Re: What Alpha command if I have the sample VB

                  In A5V10, I have to writh the function

                  Function saynum as c (text1 as N)
                  -----
                  -----
                  End function


                  or not ?
                  Correct.

                  Dim digitext As String ---> Dim digitext as C ?
                  Dim digit As integer ---> Dim digi as N ?
                  Correct but in Alpha as N will allow any number.


                  To use the function you have created you just write

                  saynum(12345)

                  anywhere you want the conversion.
                  There can be only one.

                  Comment


                    #10
                    Re: What Alpha command if I have the sample VB

                    Did you check the routines in the code archive? Search that forum with the key works "convert number" and you will find at least 2 routines for converting numbers to words. The one for Spanish is more complex because there are a number of idioms that must be handled.

                    Bill.

                    Comment


                      #11
                      Re: What Alpha command if I have the sample VB

                      Stan,

                      Thank you for your cofirmation.

                      Comment


                        #12
                        Re: What Alpha command if I have the sample VB

                        I think this a translation of the vb function. I can't test it and you will need to substitute the actual translations of the arrays and language conversions. I only see them as question marks (?).

                        Code:
                        [COLOR="red"]n[1] = "?????"
                        	n[2] = "???"
                        	n[3] = "???"
                        	n[4] = "??"
                        	n[5] = "???"
                        	n[6] = "??"
                        	n[7] = "????"
                        	n[8] = "???"
                        	n[9] = "????"
                        	
                        	l[1] = "???"
                        	l[2] = "????"
                        	l[3] = "???"
                        	l[4] = "?????"
                        	l[5] = "???"
                        	l[6] = "????"
                        	
                        	ed = "????"
                        	yee = "???"
                        	Baht = "???"
                        	Stang = "??????"
                        	Nodecimal = "????"
                        	Zero = "?????"[/COLOR]
                        Code:
                        FUNCTION Convert_Num AS c (Xvar AS n)
                        	Dim Thai_number As C
                        	
                        	Dim n[1..9] As C
                        	Dim l[1..6] As C
                        	
                        	Dim ed As C
                        	Dim yee As C
                        	Dim Baht As C
                        	Dim Stang As C
                        	Dim Nodecimal As C
                        	Dim ntostr As C
                        	Dim ndec As C
                        	
                        	n[1] = "?????"
                        	n[2] = "???"
                        	n[3] = "???"
                        	n[4] = "??"
                        	n[5] = "???"
                        	n[6] = "??"
                        	n[7] = "????"
                        	n[8] = "???"
                        	n[9] = "????"
                        	
                        	l[1] = "???"
                        	l[2] = "????"
                        	l[3] = "???"
                        	l[4] = "?????"
                        	l[5] = "???"
                        	l[6] = "????"
                        	
                        	ed = "????"
                        	yee = "???"
                        	Baht = "???"
                        	Stang = "??????"
                        	Nodecimal = "????"
                        	Zero = "?????"
                        		
                        	Dim Stt As N
                        	Dim LSTR As N
                        	Dim Decp As C
                        	Dim nstr As C
                        	Dim dcstr As C
                        	Dim chknum As N
                        	IF Xvar <> 0 THEN
                        		
                        		ntostr = Xvar
                        		nstr = Trim(ntostr)
                        		
                        		LSTR = Len(nstr)
                        		
                        		
                        		'Rem Decp = Substr(ntostr, Lstr - 2, 1)
                        		'Rem ndec = Substr(ntostr, Lstr - 1, 2)
                        		Decp = " "
                        		FOR I = 1 TO Len(nstr)
                        			IF Substr(nstr, I, 1) = "." THEN
                        				Decp = "."
                        				Exit For
                        			END IF
                        		NEXT I
                        		
                        		IF Decp = "." THEN
                        			IF Len(nstr) < I + 2 THEN
                        				ndec = Substr(nstr, I + 1, 1) + "0"
                        			ELSE
                        				ndec = Substr(nstr, I + 1, 2)
                        			END IF
                        			IF Decp = "." THEN
                        				nstr = Substr(nstr, 1, I - 1)
                        			END IF
                        		END IF
                        		
                        		Dim schar As C
                        		
                        		LSTR = I - 1
                        		
                        		FOR b = 0 TO LSTR - 1
                        			
                        			schar = Substr(nstr, LSTR - b, 1)
                        			
                        			Select 
                        			
                        			CASE b = 0
                        				IF nstr = "1" THEN
                        					Thai_number = n[1]
                        				ELSE
                        					IF schar = "1" THEN
                        						Thai_number = ed
                        					ELSE
                        						chknum = Val(schar)
                        						IF chknum > 0 THEN
                        							Thai_number = n[chknum]
                        						END IF
                        					END IF
                        				END IF
                        			CASE b = 1
                        				IF schar <> "0" THEN
                        					IF schar = "1" THEN
                        						Thai_number = l[1] + Thai_number
                        					ELSE
                        						IF schar = "2" THEN
                        							Thai_number = yee + l[1] + Thai_number
                        						ELSE
                        							chknum = Val(schar)
                        							Thai_number = n[chknum] + l[1] + Thai_number
                        						END IF
                        					END IF
                        				END IF
                        			CASE Else
                        				IF schar <> "0" .And. schar <> "." THEN
                        					chknum = Val(schar)
                        					Thai_number = n[chknum] + l[b] + Thai_number
                        				END IF
                        		END SELECT
                        		
                        	NEXT b
                        	
                        	IF Decp <> "." .Or. Val(ndec) = 0 THEN
                        		Thai_number = Thai_number + Baht + Nodecimal
                        	ELSE
                        		Thai_number = Thai_number + Baht
                        		
                        		Select 
                        		CASE Val(ndec) = 0
                        			 Thai_number = Thai_number + Baht
                        		CASE Val(ndec) < 10
                        			IF Val(ndec) = 1 THEN
                        				Thai_number = Thai_number + ed
                        			ELSE
                        				Thai_number = Thai_number + n[Val(ndec)]
                        			END IF
                        		CASE Val(ndec) = 10
                        			Thai_number = Thai_number + l[1]
                        		CASE Val(ndec) = 11
                        			Thai_number = Thai_number + l[1] + ed
                        		CASE between(Val(ndec),12,19)
                        			Thai_number = Thai_number + l[1] + n[Val(ndec) - 10]
                        		CASE Val(ndec) = 20
                        			Thai_number = Thai_number + yee + l[1]
                        		CASE between(Val(ndec),21,29)
                        			IF Val(ndec) = 21 THEN
                        				Thai_number = Thai_number + yee + l[1] + ed
                        			ELSE
                        				Thai_number = Thai_number + yee + l[1] + n[Val(ndec) - 20]
                        			END IF
                        		CASE Else
                        			IF Substr(ndec, 2, 1) <> "0" THEN
                        				Thai_number = Thai_number + n[Val(Substr(ndec, 1, 1))] + l(1) + n[Val(Substr(ndec, 2, 1))]
                        			ELSE
                        				Thai_number = Thai_number + n[Val(Substr(ndec, 1, 1))] + l(1)
                        			END IF
                        	END SELECT
                        	Thai_number = Thai_number + Stang
                        END IF
                        Convert_Num = Thai_number
                        ELSEIf Xvar = 0 THEN
                        Convert_Num = Zero + Baht + Nodecimal
                        END IF
                        
                        END FUNCTION
                        There can be only one.

                        Comment


                          #13
                          Re: What Alpha command if I have the sample VB

                          Hi Stan,

                          Thank you for your quick response
                          You see ???? due to it's my local langquage font
                          I will try your code

                          Thank you very much.
                          Peter-th

                          Comment


                            #14
                            Re: What Alpha command if I have the sample VB

                            Peter what is your local language?
                            Lee Goldberg
                            Software Development and Sales
                            Shore Consultants Ltd.
                            [email protected]
                            www.shorecon.com

                            Comment


                              #15
                              Re: What Alpha command if I have the sample VB

                              Thai.


                              Code:
                              Dim [COLOR="Red"]Thai[/COLOR]_number As C
                              There can be only one.

                              Comment

                              Working...
                              X