4 Replies Latest reply on Mar 16, 2012 7:38 AM by johnhorner

    Go to Portal Row _ How do I bring highlighted row to top

    HowardChernick

      Title

      Go to Portal Row _ How do I bring highlighted row to top

      Post

      When running a script that contains Go To Portal row, the row that i am going to gets highlighted but it always appears as the last displayed row in the list.  Is there a way to bring that highlighted row to be displayed as the top row?

      Look at the image.  User enters 1952 in the edit box.  My script finds that record in the Portal and then uses Go To Portal Row to highlight the found row.  Notice that the highlighted row is at the bottom of the displayed list.  I would like it to be scrolled to the top of the displayed list.

       

      Thanks You.

       

       

      a.jpg

        • 1. Re: Go to Portal Row _ How do I bring highlighted row to top
          philmodjunk

          Scroll the portal all the way to the last portal row, then scroll it to the row specified in the field.

          Go To Portal Row [no dialog ; count ( PortalTable::ForeignKey ) ]

          Will scroll it to the last portal row.

          Note that the last 21 records in the above portal cannot in any way be sorted to the top as you have 22 rows in your portal.

          An alternative you might play with is to specify a descending sort order for your portal that sorts on an added field that is empty for all records in the portal. If your script sets this field to one for the selected portal record, it will sort to the top of your portal. This displays it out of order, so that may not be what you want here and you also have to include code that clears the previously selected portal record's sort field before updating the newly selected portal record's sort field.

          • 2. Re: Go to Portal Row _ How do I bring highlighted row to top
            johnhorner

            hi phil... i came across this thread while searching for a similar topic and was confused about several things and i was hoping you could clarify.

            first, when you say "scroll the portal all the way to the last portal row...", do you mean manually or using some kind of script steps?  is the go to portal row script step dependant on the scrolling history (either manually or scripted)?

            second, when you use the count function are you getting the total number of records displayed in the portal?  if so, why do you use that calculation instead of simply go to portal row [last]?

            third, and perhaps more importantly, if there are say 100 related records in the portal, and the selected portal row is the 50th, and you go to the last record, won't the desired record be out of the portal altogether?  sorry, i'm very confused??

            finally, for what i am trying to do, the user manually clicks on a portal row which via a script goes to the related record displayed in detail to the right of the portal, and conditional formatting highlights the portal that matches the detail record, and a go to portal row step in the script scrolls the portal to display the record at the bottom of the portal (just as in howard's portal).  however, i would like to preserve the relative position of the selected portal row within the portal.  for example, it is the 50th out of 100 related records, but when it was selected by the user, it was the 4th row from the top.  is there any way to calculate that or restore that scroil position?  any thoughts much appreciated.  thanks...

            • 3. Re: Go to Portal Row _ How do I bring highlighted row to top
              philmodjunk

              The script step:

              Go To Portal Row [no dialog ; count ( PortalTable::ForeignKey ) ]

              Will scroll it to the last portal row

              Go to portal row can put the focus on the first, next, previous, last or a row specified by the calculation. I used the last option. Count returns the number of related records so this is then the row number of the last row. Don't know why I didn't just suggest scrolling to the last portal row as that accomplishes the same thing.

              If you read my post again, I suggested two steps 1) scroll to the last portal row and 2) scroll to the row specified. Thus, you'd use two go to portal row steps:

              Go to portal row [last]
              Go to portal row [no dialog ; //refer to field or variable that stores the number of the selected row here ]

              It's been a long time since I posted this. Test the idea and see if you try to use it.

              Unfortunately, I don't see an easy way to do wyat you want as I can't conceive of a method for determining the current scroll position of the portal when the row is clicked. You'd need to determine that before such a method could work.

              • 4. Re: Go to Portal Row _ How do I bring highlighted row to top
                johnhorner

                hi phil... have you ever seen the optical illusion of the old lady or the young woman?  when i read your original post (which i did about 10 times because i just couldn't figure out what you were saying), i kept seeing the proverbial old lady.  i thought the first line was step 1 and step 2 of the answer, and then the second line was step 3 to achieving the goal.  i was completely missing the concept that using the go to portal row script step behaves slightly differently depending on whether the target row is below or above the current active row (i tested and it does in fact work exactly as you thought it would).  typically when i am this confused i am missing a key concept or subtlety of how filemaker works because my knowledge is so limited... and now i know that my basic reading comprehension skills are similarly underdeveloped!  thanks again for taking the time to explain... if you ever do come up with a way to detect the current scroll position (or just a way to keep it from resetting when you go to a related record) please keep me posted.