March 22, 20169 yr When I set a variable this way: Set Variable [$StudentIDs = ""] the actual value of $StudentIDs is 0, not empty or blank. So it fails the IsEmpty test. Is this by design, it is a bug or am I doing something stupid? - Brad
March 22, 20169 yr can you post the actual script? Setting a variable to "" should kill the variable and it will not even show up in the data viewer. Do you still see your variable in the data viewer set to 0? (if you do: make sure you don't have anything else like a "watch" in the data viewer or a script trigger that sets it to 0 explicitly)
March 22, 20169 yr Author I am using an eval copy of FM Pro so no data viewer until I actually buy the advanced version (which I am probably doing this week.) I refactored my script so I no longer need to set the variable to empty (it was a stupid thing to do anyway). I tried to create another script to reproduce the behavior, but it is working as expected now - no 0's in sight. This is a simplified version of what I was doing - I can't copy/paste the script into plain text to post here: Set Variable [$StudentIDs; Value: ""] Show Custom Dialog ["StudentIDs is:" & $StudentIDs] The dialog was saying: StudentIDs is:0 In earlier code I was placing a comma delimited list from the results from an ExecuteSQL into the variable and iterating through the list, "popping" each element with Left/Position and Middle/Position calculations until empty and then existing loop. - Brad
March 22, 20169 yr 1 hour ago, Brad Mathews said: This is a simplified version of what I was doing - I can't copy/paste the script into plain text to post here: Set Variable [$StudentIDs; Value: ""] Show Custom Dialog ["StudentIDs is:" & $StudentIDs] The dialog was saying: StudentIDs is:0 Well, that's obviously too "simplified" - since it would not produce the claimed result. I am guessing you were either using a different variable, or looking at the result of a numerical operation involving that variable - e.g. 3 * $undefinedVariable will return 0.
March 23, 20169 yr "When I set a variable this way: Set Variable [$StudentIDs = ""] the actual value of $StudentIDs is 0, not empty or blank. So it fails the IsEmpty test." You cannot declare a variable that way. Setting a variable requires at least two entries; the variable name; and the value. If you HAVE put a value into $studentIDs; and later TEST for $studentIDs=""; then the correct result is in fact 0; because the statement is false. That's why it would have been helpful to see your complete and exact script.
March 23, 20169 yr Author Bruce, I think we have a winner! I did try and go back to duplicate that incorrect syntax when attempting to recreate the problem, but it would not let me - it insisted on using the gear icon which of course forces correct syntax. So I assumed I had just typed it wrong into the forum post so did not mention it. I still can't figure out how I managed that incorrect syntax. - Brad
March 23, 20169 yr Perhaps you did: Set Variable [ $StudentIDs; Value:$StudentIDs = "" ] That would set the variable to 0, provided it wasn't empty beforehand.
March 23, 20169 yr Author Ah yes, that looks likely. I am used to actual programming languages with real IDEs and such, so that looks like something I might have done out of habit.
Create an account or sign in to comment