10 Replies Latest reply on Dec 12, 2011 9:05 AM by robear

    multi-key relationship or other method...

    robear

      Am looking for a relationship between tables (with many records) and a Preferences table (with 1 record), which can access related records from a portal on the Preferences Layout.

       

      The objective:

      To alter a field (from 0 to 1) via script, while in a portal on the Preferences Layout (where the portal shows all records of another Table like Contacts or Invoices).

       

      Also am open to any other process.

       

      A Constant (1) relationship shows all desired records from the ther table, but only takes a GTRR to the first record of the other table.

       

      Thanks

       

       

      robear

        • 1. Re: multi-key relationship or other method...
          Stephen Huston

          Without a clearer picture of why you are doing this, my first thought is to question the so-called Constant; if it is being altered and is using an "=" join, then its not a Constant.

           

          I  think a Constant relationship  between one table and ALL records in another table should be built with a "X" join in the relationship setup rather than an "=" join. Then you don't need a special field to create the join, just any two populated fields.

           

          When setting up the GTRR script step,   check the go to related records for the entire found set to better enable the resulting set.

           

          I hope that helps a bit.

           

          Stephen Huston

          • 2. Re: multi-key relationship or other method...
            robear

            Hi Stephan

             

            Thank you for the effort & sorry if the explanation was unclear.

            The Constant/Join Relationship (X) was mentioned as an example of what failed to work with GTRR.

             

            Both (=) and (X) were tried and failed, perhaps because their is no unique identifier between records!

             

             

            Hopefully another relationship / method can allow access to change portal records from a script.

             

            robear

            • 3. Re: multi-key relationship or other method...
              ErikWegweiser

              Hi, robear:

               

              I'll accept that your relationship is valid, since you are seeing the desired related records from the preferences table. From what I understand, you're running a script that includes a GTRR step, attempting to go to a particular related record in the portal, but it is only going to the first record.

               

              The first likely issue is that you are not 'in' a portal row when that step executes. If the GTRR step executes when a portal row is not selected, the related child record displayed will be the first, from the perspective of the parent record starting point. If initiating this script from a button, the button should be in a portal row and the script must not do anything that leaves that portal row before the GTRR step. Or you must have your script somehow select the proper row before the GTRR step.

               

               

              ------------------------------------------------

              Erik Wegweiser

              Intelligent Database

              Boston, MA

              http://intelligentdb.com

              • 4. Re: multi-key relationship or other method...
                robear

                Hi Erik

                 

                I'll accept that your relationship is valid, since you are seeing the desired related records from the preferences table. From what I understand, you're running a script that includes a GTRR step, attempting to go to a particular related record in the portal, but it is only going to the first record.

                 

                • True

                 

                The first likely issue is that you are not 'in' a portal row when that step executes.

                 

                • False

                - both efforts (Icon or Checkbox) were tested inside the portal

                 

                If the relationship is not based on Unique IDs, how can GTRR work?

                 

                The objective is still to create a relationship with Unique IDs, where the Layout (with portals) has only 1 record.

                 

                Thank you for the effort.

                 

                robear

                • 5. Re: multi-key relationship or other method...
                  ErikWegweiser

                  robear: I don't understand what you mean by the objective being a relationship with unique IDs. You said you're already seeing in the portal all the related records (based on the constant relationship; no unique IDs involved).

                   

                  Are you perhaps trying to create a relationship from your single-record preferences table to a single related record that appears in this portal? (If so, you need only add another foreign key field—possibly a global—to the preferences table, and set that field to the unique ID of the one related record).

                  • 6. Re: multi-key relationship or other method...
                    timwhisenant

                    Hi Robear,

                    I see 2 ways to do what it sounds like you are looking for, ( I am sure there are more).

                    1, when a portal row is selected capture a variable with the key of the record you wish to visit and script a find.

                    2. use 2 relationships instead, first relationship is as you have it with a invisible button which sets a field in the preference table, second relationship is field just set "=" to a second occurence of the contacts, etc table and use your GTRR.

                     

                    The point is that a GTRR on a cartesian join "X" is as you have seen, is not going to work.( Sorry, I think Tom is correct the GTRR should work if drawn on the relationship correctly)

                     

                    Hope this helps,

                    Tim

                    1 of 1 people found this helpful
                    • 7. Re: multi-key relationship or other method...
                      thosliot

                      Robear,

                       

                      It's not a question of whether or not the trigger for the script (button/checkbox/whatever) is inside the portal, what matters is the context when the GTRR is performed; for example if you have a Commit Record/Request step before the GTRR then the portal row will be exited and the GTRR will operate from the context of the layout record.

                       

                      cheers

                       

                      Tom

                       

                       

                      On 9 Dec 2011, at 19:28, robear wrote

                       

                      >> The first likely issue is that you are not 'in' a portal row when that step executes.

                      >>

                      • False

                           - both efforts (Icon or Checkbox) were tested inside the portal

                       

                      • 8. Re: multi-key relationship or other method...
                        thosliot

                        Further to my previous post:

                         

                        If the GTRR is performed in the context of a portal row, then the resulting found set will be all related records from the portal TO, and the current record will be the record from the active portal row. This is the case whatever the relationship - assuming there is at least one related record. (The GTRR step's setting for 'current record' or 'current foundset' will have no effect since you say you have only one record in the preferences table).

                         

                        Therefore if you want to isolate the particular portal record, you can follow either of Tim's suggestions or you could slightly modify his first suggestion and do the GTTR, capture the current primary key then do a Constrain Found Set based on this value

                         

                        cheers

                         

                        Tom

                        • 9. Re: multi-key relationship or other method...
                          BeatriceBeaubien

                          Hi Robear,

                           

                          When I see the navigation from a portal button incorporating a GTRR going to the first related record rather than the correct record, these are the items I check:

                          1. Was a Commit record incorporated into the GTRR script? It is required if a new record was created to permit navigation to the new record, but it will lose the focus, and is guaranteed to result in the first record of relationship being chosen, rather than the correct one.

                          2. If that is case, was the portal row number captured before the Commit, and used to redirect the script to that portal row after the Commit? (one additional factor: if there are multiple portals on that layout, you have to navigate to a field exclusive to that portal, then go to the portal row).

                           

                          Here is the pseudo script code:

                          Set Variable [$portalRow; Value:Get ( ActivePortalRowNumber ) ]

                          Commit Records/Requests[ Skip data entry validation; No dialog ]

                          Go to Portal Row [ $portalRow ] [ Select; No dialog ]

                          Go to Related Record [ YourDetailsHere ]

                           

                           

                          I'd use a "=" relationship to test this, as "x" joins have particular requirements which are slightly different.

                           

                          I hope this addresses your particular situation.

                           

                           

                          Best wishes,

                           

                           

                          Beatrice Beaubien, PhD

                          i2eye, Toronto, Canada

                           

                          FileMaker Business Alliance

                          FileMaker 11 Certified Developer

                           

                          Message was edited by: Beatrice Beaubien, as the script steps from the email were mangled.

                          1 of 1 people found this helpful
                          • 10. Re: multi-key relationship or other method...
                            robear

                            Tim, Tom & Beatrice: your answers helped cement the logical process needed.

                             

                            Sample tests worked perfectly using both GTRR with & without a new window

                                 - GTRR in a new window required 7 script steps

                                 - GTRR in same window required 5 script steps

                             

                            Thank you all for your help.

                             

                            robear