3 Replies Latest reply on Mar 21, 2016 12:43 PM by Abingdon

    Isolating a Find issue


      I have a Find script that uses the previous year as part of the find criteria and for reasons I can't identify why the Year field is being changed.


      The Script (B) Steps:

          go to layout ["FindLayout"]

          Enter Find Mode []

          Set Field [TO1::Year ; Year(Get (CurrentDate) ) ) -1]

          Perform Find [Restore]    //Criteria - TO1:: WoodType; [Red Oak]


      The script is to return all records for Red Oak for the year 2015, but records from the year 2010 are included in the found set .

      I have used Script Debugger and Data Viewer to try and isolate the problem.

      In Data Viewer I monitor TO1::Year and TO1::WoodType, as I step through the script. The Year field contains the correct value until Perform Find is executed.  Once the Perform Find step is executed the WoodType field contains Red Oak but Year field changes from 2015 to 2010.


      I've already got this script to work by removing the criteria in Perform Find and making it a Set Field script step. I still don't understand why the script didn't work.


      This script(B) is a copy of an existing script(A) except for criteria (WoodType;Popular) is identical and works fine. Where I'm looking for help is in understanding why Script(A) works and Script(B) doesn't.



        • 1. Re: Isolating a Find issue

          Script B does exactly what you told it do.

          Here we are again with yet another problem resulting from the perform Find [ Restore] feature.

          The ONLY find being performed here is strictly your restored find. That's the way a restored find works.

          I personally suggest strongly and repeatedly here, to NEVER use this feature, especially if you're asking for free help.


          Enter Find Mode []

              Set Field [TO1::Year ; Year(Get (CurrentDate) ) ) -1]

              Set Field [ TO1::WoodType; "Red Oak"]

          Perform Find [] NO RESTORE!!!!!

          • 2. Re: Isolating a Find issue

            I'm with Bruce. But IF you must use restore, make it your first step then use Modify Last Find and add your new criteria. (in new record/request or in the same request). What you modify depends if you need to find both values (keep in the same request) or either value (place into a second request).



            • 3. Re: Isolating a Find issue

              My two pennyworth.

              You are mixing two methods to do a Find.

              Doing a 'Restore' Find will perform the Find that is saved. Enter Find Mode and then entering a criteria for the Find is a different method entirely.

              The Restore will always ignore anything else you have set as Find criteria.  You cannot mix the two and get the results you want.  Do one or the other, not both.


              Personally (and apologies to Bruce) I do use the Restore method a lot - but only in isolation, without trying to add in another Find variable.  For example, if I have a Find request with several consistent requests that do not need refining by another Find variable.

              For example, if I have a report to do that needs to find records from SupplierX - Not Invoiced - Invoice Value Greater than £100 - For ProductY. Then I believe it is legitimate to do this Find, then include it as a script step using Restore.


              Thing is, to understand the difference between a 'Restore Find' and an 'Enter Find Mode' Find!