So first you see all related records in the portal and then, after clicking check boxes, you want the same portal to show only the selected ones?
You'll need a portal filter that filters for the selected items, but which can also be turned "on" or "off".
Try this portal filter expression:
Not $$FilterOn or data Records 2::checkboxField
Set your button to turn on/off the filter to be:
Set Variable [$$FilterOn ; value: Not ( $$FilterOn ) ]
Refresh Window [Flush cached join results]
If the portal is not filtered, clicking your button will turn the filter on. If it is filtered, clicking the button will turn it off. When you first open the file, the filter will be off. And you can try this without the window refresh step if you want to experiment. Refresh Window [flush cached join results] is a step best avoided, but I think you'll need it here to get the filtered portal to update.
Thanks PhilModJunk - your comment that "Refresh Window [Flush cached join results]" is a step best avoided gives me pause... is there a more elegant solution? I'm trying to copy the idea of the attached screenshot; perhaps their solution is more appropriate. A user clicks on the checkboxes (in any order - or they can select the checkbox at the top for all records) then the user clicks a button "Remove all unchecked". Thoughts? Thanks!
What you show in the screen shot could be a list or table view. The button could then perform a script that uses constrain found set to filter out all non selected records from the found set.
PS. is this for a database that will have more than one user making these selections at the same time? If so, each user will see the other's selections and des-selections resulting in user frustration and confusion. There's another approach to use in cases where this is a multi-user system.
Hi PhilModJunk - Yes, I was striving for a list view idea and was originally thinking of a script that would do a constrain but didn't know how to approach it with the checkbox. And also yes, it will ultimately be for a multi-user system. Could you recommend a script for a constrain method? I think that's the right approach in this scenario... Thanks for your expertise with FM and patience with us newbies!!
Enter Find Mode  //clear the pause check box
Set Field [Yourtable::yourcheckboxfield ; 1 ]
constrain found set
The problem with this approach in a multi-user environment is that if two users are clicking check boxes on their respecitive client machines at the same time, their choices could easily interfere with each other.
To avoid this, you'd change your check box field into a button. The button's script would add/remove the records serial number from a list of selected ID's stored in either a global field or a global variable. Conditional formatting on the button can indicate whether a given record is selected. The button can even be an X or a tick mark character that appears/disappears when clicked.
Then you'd use a Constrain Found set script or a go to related records step to reduce the listed records to just those listed in the global field/variable. The 'global list' method works in a multi-user environment because changes to variables and global fields are not visible to other users.