Woe... image came out really small... let me try that again separately.
States results, which works great!
EventsAll Portal, which populates correctly.
Here's the script with portals that I'm trying to make work.
First, a key question: Is there even the tiniest chance that this database might be hosted over a network and two different users might be selecting events at the same time?
If so, the checkbox selections made by one user will interfere with those made by the other. There is a way to avoid that issue but it requires changes that affect the rest of the solution so I need that answer before I can proceed.
Note: there are quite a number of issues with your script as written.
In find mode, all non-global fields are empty except for any entered search criteria so you have a number of steps that are referencing empty fields instead of the data you are expecting to be present in those fields. That data has to be moved into global fields or variable before entering find mode so that you can use the data in the variables or global fields to create your find criteria.
And ValueCount ( DateField ) will only return a value of 1 if there is a date in the field or 0 if it is empty, it's not going to give you the number of rows in your portal. Count( ) is the function that you can use for that.
Thank you for your reply. I do wish to follow through on this and learn more about portals, but the client has decided not to proceed with this particular layout feature at this time.
This will give me more time to study up on FileMaker Pro and especially portals. I'm so green when it comes to portals.
To answer your question, yes, this will be hosted over a network and there will be 2 users. But for now, I need to wrap my head around the whole Find Mode principle. It's not something I'm use to yet.
Again, many thanks for your expertise!
Then I'll just briefly outline a method for temporarily selecting records that provides each user with their own list and keeps each user's selections from interfering with the other's:
Instead of a check box field, put a button in the row (portal or list view layout ) to perform a script for selecting/deselecting a record. The script adds or deletes the Primary key value of the record clicked to/from a return separated list of values stored in a global variable or global field. (Values in variables and global fields are kept separate for each user.)
Then a conditional format expression can compare the primary key of the current record with this list of selected ID's and show a visible change when the ID of the current record is a member of the list. By changing font sizes, this conditional format can even change font sizes to make text such as the letter X or a ding bat font's "tick mark" appear and disappear as needed to give your users a "Check box" type look and feel.
Your find script, which can then be very similar to your "states" script, can then use this list to find records. And another option if you use a global field, is to set up a relationship that uses the global field as a match field to either display the list in a portal or to use Go To Related Records to bring up that list as a found set on a layout.
If you haven't seen it already, you may find this thread of scripted find examples useful: Scripted Find Examples