7 Replies Latest reply on May 28, 2013 2:34 AM by RafaelCaballe

    Excluding records from a given found set

    RafaelCaballe

      I need to exclude some records (their IDs are stored in a variable properly separated by ¶) from a certain found set. What is the most advisable script steps arrangement to exclude a record (knowing its ID) from a found set...? It seems an easy issue but I am propably missing anything... I can't get it running...!

      Thanks!

        • 1. Re: Excluding records from a given found set
          DavidZakary

          Since you have the list of records to be excluded you could do a loop through them. Grab the first value, put into variable, do a Constrain Found set with the variable as the criteria, end loop.

          • 2. Re: Excluding records from a given found set
            RafaelCaballe

            When constraining the found set, I would need to constrain to those records that do NOT match the criteria. FM does not allow to specify a "non-compliant" search criteria. In other words, I can't tell to FM: constrain the found set to those records which DO NOT MATCH a criteria. FM only allows constrain the found set to those records that match a criteria.

            • 3. Re: Excluding records from a given found set
              DavidZakary

              Change the action to Omit Records instead of Find Records in the search criteria dialog box

              • 4. Re: Excluding records from a given found set
                RafaelCaballe

                I am trying to script the process. That is the problem...when scripting I can't omit the records in such a way...

                • 5. Re: Excluding records from a given found set
                  DrewTenenholz

                  Rafael --

                   

                  I suggest you try doing this the 'old fashioned' way.  Before we could enter specific criteria into the Find/Constrain/Extend script steps we used to do it this way:

                   

                  Enter Find Mode

                  If ( Get ( WindowMode ) = 1 )  // really check to see if we are in Find mode, for the paranoid

                  Set Field ( yourField  ; yourValue )

                  Omit Records  // necessary to express a logical NOT operator

                  Perform Find

                  End If

                   

                  Note that even though you MAY put criteria into a Find/Constrain/Extend step, you are not REQUIRED to do so.  Being in Find Mode, then using New/Record/Request, then using Perform Find/Constrain/Extend while leaving the criteria blank in the Script Step will execute the search pretty much exactly like it would if you were doing the whole task manually.  It also happens to be easier to read when you are debugging a script, so I still use it more often than the 'quick' way.

                   

                   

                  In your case, you can build on the concept is a couple of ways, mine would look like:

                   

                  Set Variable ( $List ; list_of_record_IDs )

                  Enter Find Mode

                  If ( Get ( windowMode ) = 1 )

                    Loop

                      Set Variable ( $firstItem ; GetValue ( $list ; 1 )

                      Set Variable ( $remainingItems ; MiddleValues ( $List ; 2 ; ValueCount ( $List ) - 1 ) )

                      Exit Loop if (IsEmpty ( $firstItem ) )

                      New Record/Request

                      Set Field ( someField ; $firstValue )

                      Omit Records

                    End Loop

                    Constrain Records // with NO criteria in this script step

                    Set Variable ( $lastError ; Get ( LastError ) )

                  End If

                  ....

                   

                   

                  HTH,

                  Drew Tenenholz

                  1 of 1 people found this helpful
                  • 6. Re: Excluding records from a given found set
                    DavidJondreau

                    Sure you can.

                     

                    In the Constrain Found Set[] script step, when you open the Specify Find Requests dialog and then open the New Find Request dialog you have a drop down menu labeled Action... You can change that menu selection from the default Find to Omit.

                    • 7. Re: Excluding records from a given found set
                      RafaelCaballe

                      Thanks David, It was a bit hidden for a newby as me...! Solved.