1 2 Previous Next 17 Replies Latest reply on Jun 16, 2017 5:23 PM by keywords

    Get (Active Portal Row Number)

    enzo_2017

      Hello!

       

      I have a script where I am trying to get the active portal row record (Plan Year) , so then I can navigate into a different layout's same record number (in the Contact page)

      The database hierarchy is   Contact -> Plan -> Plan Year -> Detailed Items

       

      I have tried going to the related record using primary keys, however, my results show up with multiple found records because there are multiple plan years in each plan, and multiple plans for each contact. Each time I GTRR, it comes up with the right found set of records, but it will go to a related record that is not the plan year I want.

       

      I have written a script to try and bypass this, by matching up the portal row location to the nth record. This is working most of the time, but every once in awhile the Get(ActivePortalRowNumber) -

        • 1. Re: Get (Active Portal Row Number)
          dale_allyn

          It's unclear to me what you're trying to accomplish, but... the Get (ActivePortalRowNumber) is good for movements (or actions) on the same layout, or for returning to the same layout and registering from where you traveled (to the new layout) and to where to return.

           

          Depending on what you're trying to accomplish, you may need to be storing a global variable (Set Variable: $$yourVariable) populated by a field that is available on both layouts (item_ID, Client_ID, SubmissionLineItem,... whatever); then do a find on the second layout based on that meaningful identifier.

           

          If you DID happen to store the active portal row number before you left the first layout, you can return to that same row via script on the original layout if needed.

           

          Difficult to zero in with the info provided.

          • 2. Re: Get (Active Portal Row Number)
            Philip_Jaffe

            Have you selected "match current record only" in your GTRR?

            • 3. Re: Get (Active Portal Row Number)
              enzo_2017

              I have 2 layouts: Contacts and Plan Year List.

               

              In the Contact Layout, there is a portal of Plan Years that are connected to the contact. The goal is to click into the nth portal row, and run a script that navigates to the nth record in 'Plan Year List'.

               

              I have set a global variable for Get (ActivePortalRowNumber) while still in the Contact Layout (the global variable has fields in both the Contact Layout and the Plan Year List Layout).  and then the script goes to a related record in the Plan Year List layout.

               

               

              Hopefully that makes more sense?

              • 4. Re: Get (Active Portal Row Number)
                enzo_2017

                yup!

                 

                It still matches with all of the "years" within the "plan"

                • 5. Re: Get (Active Portal Row Number)
                  Philip_Jaffe

                  Well Active Portal Row Number may not always match up with record number depending on how the portal is sorted and filtered, vs how the list layout your going to is filtered and sorted.  So that's one thing I'd check.

                   

                  But more essentially, I am not sure you even need all of that scripting.

                   

                  GTRR Show related should take you there and land you on the record you want if the GTRR button is in your portal row.

                  1 of 1 people found this helpful
                  • 6. Re: Get (Active Portal Row Number)
                    philmodjunk

                    It still matches with all of the "years" within the "plan"

                    That makes no sense. It's correct for what you describe, but irrelevant to the task of selecting one Plan Year record and finding the single contact record linked to it. If you are going from plan years to a contact record, while there may be many plans for a contact and many plan years for a plan, you are moving in the opposite direction. For any given plan year, there should be one and only one plan and for any given plan, there should be one and only one contact.

                     

                    So either something isn't set up right in your layout or your Go To Related records step, or the relationships are not what you described in your first post.

                    • 7. Re: Get (Active Portal Row Number)
                      arjen.evertse

                      GTRR from a portal will only give a single record match if you are go to the related record from the same TO as the portal is based on. If you go to a child of the portal TO it will match all records of the parent record of the TO your lay-out is based on.

                       

                      You best changes are to grap the key of the child's child and use a scripted find.

                      1 of 1 people found this helpful
                      • 8. Re: Get (Active Portal Row Number)
                        philmodjunk

                        If using a recent version of FileMaker, you only Go To Related Records for a button in the portal to plan year

                         

                        See this demo.

                        1 of 1 people found this helpful
                        • 9. Re: Get (Active Portal Row Number)
                          enzo_2017

                          Thanks!

                           

                          Yes, that's what I ended up doing. I stored the primary key as a global variable, and did a loop "go to next record" within the found set until the stored global variable matched with the primary key on the Plan Year List Layout. It works now!

                          • 10. Re: Get (Active Portal Row Number)
                            philmodjunk

                            It may work, but you are doing it the hard way. Note that my demo does it all in a single GTRR script step.

                            • 11. Re: Get (Active Portal Row Number)
                              arjen.evertse

                              A loop to go through a found set and find the single record you are looking for comparing the key to a variable is not really the way I would do this.

                               

                              If your case matches with the GrandChildToParent example from philmodjunk his example is showing the best way. This would however not work if you want to go to a foundset with a single grandchild from the child record in a portal on a lay-out based on the parent TO.

                               

                              With other words, if you navigate into the one direction of your relation all is fine, but if you move into the many direction using GTRR to a grandchild TO from a portal based on the child TO you will get all related records not only from the portal row you clicked on.

                               

                              You wouldn't be able to produce a single record found set from PlanYear if you have multiple Plans having together multiple PlanYears and you are starting from the Plan portal on the Contacts lay-out.

                               

                              If that is the case, a scripted find (not a loop) is in my opinion the way to go.

                              • 12. Re: Get (Active Portal Row Number)
                                enzo_2017

                                yes, arjen.evertse... this is more how my solution is set up. Sorry for the ambiguity in my original posting. I was able to get the script working with the scripted find as well.

                                 

                                Thanks for all of your help!

                                • 13. Re: Get (Active Portal Row Number)
                                  philmodjunk

                                  "This would however not work if you want to go to a foundset with a single grandchild from the child record in a portal on a lay-out based on the parent TO."

                                   

                                  Not sure that makes sense. If you are clicking a child record on the parent layout, that fails to do anything to select a specific grand child. Did you perhaps mean to click a grand child in a portal to grand child located on the patent layout?

                                   

                                  in that case, no you do not get a found set of a single record, but the portal record you clicked will be the current record on the target layout. In many cases, such as with a form view layout, that is sufficient, but you can easily isolate the current record with a single added step if grandchild has a primary key. Just do a Find Matching Records specifying the primary key field after pulling it up on the target layout via the GTRR step.

                                  • 14. Re: Get (Active Portal Row Number)
                                    arjen.evertse

                                    I probably didn't describe myself well.

                                     

                                    What I was trying to point out that the GTRR from a portal row will only use the portal row's record as "context" to bring you to the target record if the target TO of the GTRR is the same as the portal TO. If your GTRR target is further away in the relationship, GTRR gets you all records related to the parent and the record it navigates to within this foundset is the first record of that foundset. This is not necessarily a record related to the portal row record from which the GTRR started.

                                    1 2 Previous Next