I am having trouble getting random states from the cstates() function. In the end, I am trying to fill a database with random data so I can test performance and functionality with a larger recordset.
1) I am seeing that if you ? print the value of the round function it will ignore the decimal places if nothing else is printed on the line.
2) I can create a crlf list of states, but initializing the array does not enter the values into the array.
Can you see what I am doing wrong?
Here is the code that I am using:
1) I am seeing that if you ? print the value of the round function it will ignore the decimal places if nothing else is printed on the line.
2) I can create a crlf list of states, but initializing the array does not enter the values into the array.
Can you see what I am doing wrong?
Here is the code that I am using:
Code:
Dim strStatesList As C Dim strStatesList1 As C Dim strState As C dim myStates[79] AS P Dim iState As N 'set variable istate to get a random number between 1 and 78 iState = ROUND((RAND() * 78),0) 'round to nearest integer with no decimals 'View strange decimal behavior ? iState + ("<br>") ? iState ? "<br>" ? int(iState) ? "<br>" + "The first will print without decimals, the next two will, and to the right will not: " + int(iState) 'Use the built in function to get list of states strStatesList1 = cstates("S" + ",") ' Put that list into a comma separated list strStatesList = comma_to_crlf(strStatesList1) ' convert that list into crlf (unneeded step if replace "," in above line with crlf() ? "<br> How many lines are in strStatesList = " + line_count(strStatesList) ? "<br> 79 is the correct number of lines" 'Using the above list create an array using the initialize function myStates.initialize(strStatesList) ? "<br>Here is the list of states in the array: " + myStates.dump() strState = myStates[iState] ? "<br>This is the random state choosen: " + strState
Comment