4 Replies Latest reply on May 29, 2015 5:01 PM by rtolliver

    Script Syntax for IF function



      Script Syntax for IF function


      I'm looking for direction on how best to write a script that looks for a ranges of number values.  My original was written in MS Access 2010 using the Case function.

      Case 1; length <= 84" ; Perform Find

      Case 2; length >=90" and <=108" ; Perform Find

      Case 3; length >=108" and <=132"  ; Perform Find

      Case 4; length >=132" and <=156" ; Perform Find

      Case 5; length >=156" and <=180" ; Perform Find

      Case 6; length >=180" ; Perform Find

      I can only find the Case Function in Specify Calculation of Fields, Case Function is not available in Edit Script Control section. What is available is the IF function and I haven't found the syntax information I need to write the Find Range script for the cases above.

      Any suggestion for documents or articles?


        • 1. Re: Script Syntax for IF function

          How does each "Perform Find" result differ from another in this logic tree?

          If, else-IF, is the only scripted option, but I can think of multiple alternatives that might use a very different approach to get the same result.

          If your perform finds are to look up values based on the range of values in "length", I can do this with a table look up that requires little or no scripting at all.

          • 2. Re: Script Syntax for IF function

            The preform finds are looking up values based on values in "length". Please keep in mind that in the Case Function example given are selections in a dropdown box

            • 3. Re: Script Syntax for IF function

              A single find can use the contents of the drop down box to find the correct record for your value. You don't need a separate find for each value range. This works especially well if you make the field for the drop down box a field with global storage. (Each time that you find yourself wanting to add an edit box to the layout that you don't want to associate with a field in the layout's table like you might in an Access or VB form, consider using a field with global storage--which can be a field from any table in your file when it's defined as "global".)

              See this thread for scripted find examples: Scripted Find Examples

              But I'd use a relationship to look up the value from a related table:

              LayoutTable::DropDownFIeld > LookUpTable::MinValue AND
              LayoutTable::DropDownField < LookUpTable::MaxValue

              Will allow you to access a value in LookUpTable from a record in LayoutTable without any script at all.