3 Replies Latest reply on Jun 4, 2013 9:31 AM by philmodjunk

    Using Portals as Pickers



      Using Portals as Pickers


           I've got a parent table with a portal that lists several records in the child table, related through the parent's IDKey field and the child's Parent_ID_FK field.

           What I want is to be able to select various child-records in the portal and run a script on those (and only those) records.   Radio buttons or checkboxes would be ideal, here, but I can't figure out how to use those to do what I want.

           I have a beginner's grasp of arrays, but I'm a bit lost as to how I would use one here: does my best solution involve creating a checkbox in the portal row that adds the portal-row ID to an array?   A brief step-by-step how-to would be helpful, if so: I'm not entirely clear on how to manipulate arrays yet.

           Thanks in advance.

        • 1. Re: Using Portals as Pickers

               I don't see a use for an array here, there are better options for this in FileMaker.

               For adding a control that users can click to select a portal row, you can define a field in your portal's table and format it with a single value custom value list. (The value can be the word "selected" or just the number 1). Then format the field as a check box via the Inspector's data tab.

               That approach is simple to set up, but if you have multiple users accessing your database at the same time, each user's selections will be visible to all other users and may interfere with the selects another user may make at the same time. So let me know if this will be a hosted solution and I'll describe a scripted method that builds a list of selected records by ID such that each user's list is kept separate from other users.

               PS. when using 1 as the single check box value, developers normally resize the field so that the 1 is not visible. They may add label text next to the check box or just have an unlabeled checkbox.

          • 2. Re: Using Portals as Pickers

                 That's not a bad solution, Phil: I've resized checkboxes like that for other applications.  I was hoping to avoid using a field-based solution just because of the problem of junk-data... I presume you would build into the end of any scripts using the "Selected" field a scrap of script that deletes the "1" value so the script would not return false finds later?

                 The file isn't currently hosted, but I would like it to be eventually, so any solution that favors multiple users would be preferred. 


            • 3. Re: Using Portals as Pickers

                   Replace Field Contents can be used to clear the fields so that the user's selections do not persist.

                   To see an example of how clicking a control can build/edit a list of values see this fairly old demo file. It uses a calculation field to show which values in a portal are selected, but a conditional format can be used instead to make layout text (such as a tick mark) appear/disappear instead.


                   If the lists built by clicking a control in the row of records (doesn't have to be in a portal like the demo), are stored in either a global variable or a global field, the values for each user will be kept separate from each other.