5 Replies Latest reply on Sep 27, 2010 4:08 PM by Marty1

    AND Calculations



      AND Calculations



      I am having dificulty to write a calculation using the AND function, (if that is what I should be using)

      I am trying to find a certain product number that apprear on any invoices between certain dates.

      I have a field 'product_num' and 2 global fields 'date_low' & 'date_high_

      I have  a script to find the invoices with that product - it is.....

      Enter Find Mode []

      Insert Calculated Result [Select; Lines_Cust_Inv::product_num; '=' & globals::x_product_num]

      Perform Find []


      The script to find the invoices between the dates, I have as....

      Enter Find Mode []

      Insert Calculated Result [Select; Lines_Cust_Inv::Date; ">" & Globals::date_low & "<" & Globals::date_high]

      Perform Find []


      Please can you help with the syntax (or another way) to find the products with a specific part number invoices between specific dates.

      Many thanks in advance


        • 1. Re: AND Calculations

          Try this:

          Enter Find Mode []
          Set Field [ Lines_Cust_Inv::product_num; globals::x_product_num ]
          Set Field [ Lines_Cust_Inv::Date; Globals::date_low & "..." & Globals::date_high]
          Perform Find []



          • 2. Re: AND Calculations

            Just make sure x_product_num is also a field with global storage in Nick's example script.

            • 3. Re: AND Calculations

              Hi, Thanks alot, works a dream !!

              Just a question, why use the command 'Set Filed [...' rather than 'Insert Calculated Result[...'

              Does Set Field not overwrite the existing data in the field      Lines_Cust_Inv::Date    ?  as I need to preserve this vaule.



              • 4. Re: AND Calculations

                It will not overwrite data in the script example Nick posted as there is no data to overwrite. (In find mode, existing data can't be modified.)

                Insert Calculated Result has two key differences when compared to Set Field:

                1. The referenced field where the data is to be inserted must be present on the current layout or the script step silently fails to work.
                2. You can use this step with the current cursor position to insert data without overwriting existing data in the field.


                Generally speaking the "insert" script steps that insert data other than files and images are usually used for "enhanced edit" tools that rely on the cursor positions. Most developers prefer Set Field for all other such actions as removing the target field from the layout in some future edit of the layout won't cause the script to mysteriously stop working the way it will with the "insert" script steps.

                • 5. Re: AND Calculations


                  Thanks for all your assistance

                  Have a great day (evening)