2 Replies Latest reply on Mar 17, 2014 9:04 AM by mdsilvers

    Populating Portal based on results in another table - Need assistance

    mdsilvers

      I need some help. I’ve hit a wall on trying to figure out a solution on how to add rows dynamically to a portal based on flags in another table. In my mind I think this should be possible in FMP, but I’m used to working with PL/SQL and other languages where I have full access to easily setup and manipulate data.

       

      I have a table for ‘Crew’. It is basically a table with names and personal information. One field is called ‘Default Crew’ and is either Y or N.

       

      I want to be able to populate rows in a portal for another table - called Trip Crew - by the user pushing a button that will automatically add the crew_ids from the Crew table to the portal based on the flag being ‘Y’. At this point I’m not sure how to tackle this item in FMP 13. Any thoughts? Thanks for your help.

        • 1. Re: Populating Portal based on results in another table - Need assistance
          erolst

          mdsilvers wrote:

          but I’m used to working with PL/SQL and other languages where I have full access to easily setup and manipulate data.

          Which you think is not possible in FileMaker?

           

          You can write a script along the lines of

           

          Set Variable ( $defaultCrewList ; ExecuteSQL ( "SELECT primaryCrewID FROM Crew WHERE defaultCrew = "Y" ; "" ; "" )

          # I suggest using 1/0 as Boolean value(s)

          If ( IsEmpty ( $defaultCrewList ) ]

            Exit Script

          End If

          Set Variable ( $tripID ; trip::tripID ]

          Go to Layout ( TripCrew ( TripCrew) ]

          Loop

            Set Variable [ $i ; $i + 1 ]

            New Record/Request

            Set Field [ TripCrew::_fk_tripID ; $tripID ]

            Set Field [ TripCrew::_fk_crewID ; GetValue ( $defaultCrewList ; $i ]

            Exit Loop if [ $i = ValueCount ( $defaultCrewList ) ]

          End Loop

          Go to Layout [ original layout ]

           

          Have fun with FileMaker!

          • 2. Re: Populating Portal based on results in another table - Need assistance
            mdsilvers

            Thanks Erolst!  I’ll give this a try!