AnsweredAssumed Answered

Scripting Help Needed Using 'Loop' and 'If'

Question asked by Atkins on Sep 25, 2012
Latest reply on Sep 25, 2012 by philmodjunk


Scripting Help Needed Using 'Loop' and 'If'



     I think this is a fairly basic question but I can't seem to figure it out.  I'm trying to use the 'Loop' and 'If' commands to run a script that will check to see if a value that the user inputs is valid and already exists.  There are other elements to my script but they appear to be working fine, so I'll just ask about the part I'm having trouble with.  In the example below I've tried using 'isValid' with the corresponding table field in the 'If' statement, but it always returns a valid result.  I read through the help manual and it looks like 'isValid' doesn't work like I was hoping.  I'm not sure what other calculation could be used to check the existing contents of a table field and return a result.

     Here's my logic so far:


     If [check for existing number here]

     Set Variable [$x; Value:1]


     Set Variable [$x; Value: 0]

     End If

     Exit Loop If [$x = 1]

     End Loop

     That's the basis of what I'm trying to do.  If it loops it'll ask the user again to input a valid number so they get another shot.  All the user-entry and 'Perform Find' (not shown) seems to be working fine as I can get this to function when the Loop sequence is not involved.  When using the 'isValid' calculation for the 'If' statement it returned positive each time and exited the loop, so I will assume that if I can get the positive result to come only when it's actually true that it will again exit the loop accordingly.

     Thanks for any help or assistance!