3 Replies Latest reply on Jan 28, 2014 7:21 AM by PaulLawrence

    Constrain Found Set Working Once Only

    PaulLawrence

      Title

      Constrain Found Set Working Once Only

      Post

           I have the need to search a found set for records that have a box checked for the purpose of changing select field values in the checked records in a batch.

           So, I call up a NEW window with the batch-change layout in it thinking that this will pass the found set but not affect the found set.

           Then I use a CONSTRAIN find to search the found set for any checked boxes.

           This works but it isn't actually constrained to the found set, because it finds checked boxes outside of the found set.

           Also, this seems to only work accurately ONCE. If I close the new window/layout, add a checked box to the found set and then call up the NEW window again. The CONSTRAIN seems to not find the added checked box.

           I have verified that after the NEW window opens, a Get (FoundCount) shows the correct number of records in the found set.

           I sure am missing something. Any suggestions?

           SCRIPT:

      Freeze Window

      Set Error Capture [ On ]

      Enter Browse Mode

      Set Variable [ $$FlagCount; Value:0 ]

      New Window [ Name: "Batch Change Flagged " & Get ( LayoutName ) & " Records"; Top: 150; Left: 300; Style: Dialog; Close: “Yes”; Minimize: “No”; Maximize: “No”; Zoom Control Area: “No”; Resize: “No” ]

      Go to Layout [ “Reading: Batch Change” (Drawing POV » Reading) ]

      Show/Hide Toolbars [ Hide ]

      Adjust Window [ Resize to Fit ]
      Constrain Found Set [ Specified Find Requests: Find Records; Criteria: Drawing POV » Reading::flag: “1” ] [ Restore ]

      Set Variable [ $error; Value:Get ( LastError ) ]
                           

      Set Variable [ $$FlagCount; Value:Get ( FoundCount ) ]

      If [ $error ]

      Show Custom Dialog [ Title: "Found Error"; Message: "No flag boxes were checked." & ¶ & ¶ & "Check some boxes to make changes."; Default Button: “OK”, Commit: “No” ]

      Perform Script [ “Close: Window Current Show All Records” ]

      Else

      # Make sure first record. 

      Go to Record/Request/Page [ First ]

      # Save target fields of first record to global fields for possible restoring on cancel

      End If

      Set Error Capture [ Off ]

      Exit Script [ ]

            

           RESEARCH:  http://forums.filemaker.com/posts/4a4f90d1e4?commentId=179828#179828