2 Replies Latest reply on Feb 14, 2012 9:20 AM by philmodjunk

    Text if a record falls between two numbers

    JacksonGallagher

      Title

      Text if a record falls between two numbers

      Post

      I'm trying to write a script that takes a variable (passes as a script parameter) we'll call this $number. I then want to compare it to $low and $high. If $number is not between these two I want to omit the record and only be left records where $number is between $low and $high. I am trying:

       

      if($low < $number AND $number < $high)

      Go to next record

      else

      omit record

      endif

       

      Is this the proper way or am I missing something? Either way, it is not working.

      Any help is greatly appreciated.

      Screen_Shot_2012-02-14_at_10.16.04_AM.png

        • 1. Re: Text if a record falls between two numbers
          philmodjunk

          From your script, $Cue is the value passed as a script parameter? and you have this step: Set variable [$Cue ; value: Get ( ScriptParameter ) ] preceding the steps shown above?

          You'd also need a Show All Records at the start here since you are comparing $I to Get ( TotalRecordCount ). (Instead, you can use the exit after last option in the go to record step.)

          Use this expression as your If step:

          If [ ( $Cue > Spots::CueIn ) and ( $Cue < Spots::CueOut ) ]

          Your show custom dialog might be misleading here as it comes just before you change the value of the variables. I'd put it after the set variable expression.

          That said, I don't see any obvious errors. are cuein and cueout fields of type number?

          Try simplifying the e

          • 2. Re: Text if a record falls between two numbers
            philmodjunk

            You can also do this without the looping script if you perform a find:

            Enter Find Mode []
            Set field [Spots::cueIn ; "<" & $Cue ]
            Set field [Spots::cueOut ; ">" & $Cue]
            Set error Capture [on]
            Perform Find[]