6 Replies Latest reply on Nov 4, 2016 11:48 AM by ChrisJohnston

    Sort list like portal sort?

    ChrisJohnston

      Is it possible to rearrange what the List function produces to be in the same order as the sort you have on your portal? I am asking because I want to use a custom function like this one to go to a specific portal row. With a function like this, it will not work on a sorted portal. I am figuring that you could rearrange your list to match the portal sort. If so it would work. Thanks

        • 1. Re: Sort list like portal sort?
          Johan Hedman

          Then you have to create a relationship that have the same Sort order as you have in your portal. Then use that new Relationship inside your List ( )

          1 of 1 people found this helpful
          • 2. Re: Sort list like portal sort?
            erolst

            To add to Johan's reply: functions always operate on the data level, not on the portal level, which is sensible because

             

            one TO < many portals

             

            which consequently means that you need to either sort the relationship the portal is based on as desired (which will affect all other functions that work via that relationship), or create a new, dedicated TO for a new relationship and base the portal on that TO.

             

            Also be aware that instead of using the Custom Function to target a calculated portal row, you can do this “by foot” and use a loop to walk though the portal until you reach the row with the desired value. This method may be slower, but it works with any portal, also filtered ones.

            1 of 1 people found this helpful
            • 3. Re: Sort list like portal sort?
              ChrisJohnston

              That makes sense. I have not worked much with sorted relationships. I need to start, I might be missing out. Thanks

              • 4. Re: Sort list like portal sort?
                ChrisJohnston

                Yes, I think how you describe is what I am dealing with. I think I found a solution for most part to the "return to the interface's portal row" but I will use what you say. It was the way it functions with the portal looping to find records that made me want to find another way. I realized that you might be able to determine the portal count at start, but that may change based on your transaction. This helps a lot. Thanks

                • 5. Re: Sort list like portal sort?
                  erolst

                  I'm glad it helps, though I think you should stick with your original approach.

                   

                  A typical scenario:

                   

                  • present the user with a selector

                  • add selected item(s) to related table

                   

                  I normally use a hidden portal based on a relationship that allows creation, and use another portal based on a relationship that does not; this means you don't have to leave the layout which is preferable for a number of reasons: it is usually faster because you don't have to load the other layout, then reload the original one, and there is no trouble with controlling layout triggers.

                   

                  • take the user to the display portal and the row with the newly added item (or the first (or last) of several new ones)

                  • enter e.g. the quantity field

                   

                  In this scenario there is usually no reason to not define the sort order in the relationship, or to filter the portal, so calculating the target row would work just fine.

                   

                  Anyway, it's always helpful to know more than one method, and to be aware which one is the best depending on the circumstances …

                   

                  Happy FileMakering!

                  • 6. Re: Sort list like portal sort?
                    ChrisJohnston

                    Anyway, it's always helpful to know more than one method, and to be aware which one is the best depending on the circumstances …

                     

                    Yes, my feeling in all that I do.

                    Wow... a hidden portal... what an Idea, This will be useful to build with. Thanks