12 Replies Latest reply on Mar 18, 2014 8:20 AM by john.s

    Showing first portal record

    john.s

      Title

      Showing first portal record

      Post

           Hi,

           I have a layout based on a table (Schools) with a portal to a self join table.  The schools  portal goes to related records in the Seniors table.  The schools portal is sorted by School Name. When the layout is opened the related records are from the first school in the table not the first school in the portal.  As I click on each school they show the correct related records.  I would like the default school to be the first school in the portal.  I've tried to sort the table in a script trigger that opens the layout but that didn't work.  I've tried to Go to Portal row First but it goes the the first record in the related portal.

           I must be missing something simple but can't figure out what that is.  Any help would be greatly appreciated.

           John

            

        • 1. Re: Showing first portal record
          philmodjunk

               Double check to see what table occurrence is referenced by the field(s) in the portal. Make sure that they are from either the portal's table occurrence or a table occurrence that is linked to the portal's table occurrence without first linking to the table's table occurrence.

          • 2. Re: Showing first portal record
            john.s

                 The devil is always in the details.

                 I just double checked and this Report is based on the a table occurrence of Schools called "Schools|High Schools for Seniors" the portal is based on another occurrence called (Schools|High Schools) there is only one field in the portal and it is from the same Schools|High Schools table occurrence.  

                 The two table occurrences are linked by a calculated global field (set to 1) = Active Status (value is 1 for active schools)

                 I have an On Layout enter script trigger that does a scripted find for high schools.  I was assuming that I could sort in that script

                 Neither of the School table occurrences are linked to the original Schools table.

            • 3. Re: Showing first portal record
              philmodjunk

                   I misunderstood your original post. I thought that you had incorrect data showing in the portal. But re-reading your first post suggests that this may not be the issue.

                   What do you mean by: "When the layout is opened the related records are from the first school in the table not the first school in the portal."?

                   Do you mean that you are doing a Go To Related records via a button in the portal row, but that it is not bringing up the expected found set of records on the layout specified in the GTRR step?

                   If so, I need to see the relationships defined. best guess is that you need an occurrence of the specified table linked to the portal's table so that you can specify that occurrence as the "table" in the GTRR step.

              • 4. Re: Showing first portal record
                john.s

                     The GTRR is working fine.  I have a main layout with a reports tab.  One of the buttons on that layout is a button that has an action "Go To Layout" and it goes to the layout with the portals I described.  When that layout opens it shows records in the Related Seniors Portal from the first record in the Schools Table i.e. the first record I entered when I built the table.   Because the portal to the list of schools is in alfa order I would like the layout to open and show the records from the first school in the sorted portal.  There is no problem with the data I'm just being picky and want the first school in the portal to be the default school for the related records. 

                     I could export the schools table to a temp table, delete the original table data, sort the records in the temp table by school, and import them back into the schools table but that is only a temporary fix.

                      

                • 5. Re: Showing first portal record
                  philmodjunk

                       Please show the exact relationships involved. Each time I try to understand your description, I encounter a contradiction. As best I can understand it, you want the layout's current record to somehow match the first portal record in a portal on that same layout and that's what has me scratching my head...

                  • 6. Re: Showing first portal record
                    john.s

                         Schools|High Schools for Seniors ---< Seniors

                         Schools|High Schools for Seniors >--- Schools | High Schools

                         Relationship

                         Schools|High Schools for Seniors: __pk_SchoolCode = Seniors: _fk_SchoolCode

                         Schools|High Schools for Seniors: ActiveStatue = School | High Schools: cg_ActiveStatue          // Selects active schools

                         Here is a screen shot of the report layout with test data.  Notice when it opens it shows the Records from East Lyme (first record entered into the schools table)  I would like it to open with the records for Branford (first school in the sorted portal).

                          

                    • 7. Re: Showing first portal record
                      philmodjunk

                           Schools|High Schools for Seniors >--- Schools | High Schools

                           Schools|High Schools for Seniors: ActiveStatue = School | High Schools: cg_ActiveStatue          // Selects active schools

                           You can't use your global field on the "many" side of a relationship. You have to use indexed fields with values specific to each record on that side of a relationship.

                           Looks like you need to use:

                           Schools|High Schools for Seniors::cg_ActiveStatue  = School | High Schools::ActiveStatue

                      • 8. Re: Showing first portal record
                        john.s

                             Thanks Phil,

                              So at first I was confused by your comment…the portals were working so how could this be.  Then I said to myself…Phil knows way way more than I will ever know so I need to figure out why they are working when they shouldn't .  And as I suspected, I had made a double mistake that resulted in me creating a work around that I had overlooked.  The relationships that I set up wrong were basically ignored because on one side I had a text value and on the other I had a number.  So then I checked the portal and found that I had put on a filter to do what the relationship was intended to do.

                             Now I have the relationship set up as you instructed with text to text links and I have removed the portal filter and the portals work as planned only faster because I removed the filters.  Now back to my original question…can I get the layout to default to show the records for the first portal row record and not the first record in the table?  It's a picky thing but the layout looks strange to me when it opens up to a school in the middle of the portal list.

                        • 9. Re: Showing first portal record
                          philmodjunk

                               In your script, after using Go to Layout to bring up this layout, use Go to Related Records, specifying the portal's table, but this current layout as the layout to bring up the desired found set of records.

                          • 10. Re: Showing first portal record
                            john.s

                                 Sorry Phil but I must still be missing something.

                                 I have a two step script:

                                 Go to Layout [Seniors Report by School" (Schools | High School for Seniors)]

                                 Go to Related Records [From table: "Schools | High Schools"; Using layout: <Current Layout>]     // Portal is based on "Schools | High Schools

                                 The layout opens up to the first record originally created in the Schools table not the first record in the portal.  The same as the screen shot I sent yesterday.

                            • 11. Re: Showing first portal record
                              philmodjunk

                                   Assuming that your portal is sorted, then sort your records in the same order as the portal and use Go to record to make the first record the current record.

                              • 12. Re: Showing first portal record
                                john.s

                                     That worked…thank you for all of your help Phil.