Jump to content

Sorting a portal for current table


RavingLuhn
 Share

Recommended Posts

What are my options for sorting a portal which displays records from the same table that the layout is based on?

There's a products table and a status table. The products table contains a list of unique items, and the status table indicates the status of the product for each year. My layout is based on the products table and contains a global field to select a year, which returns the status for that year in the product portal. The problem is that my product list won't stay sorted. I've written a script to sort the records on layout enter, but when I add scripts for other things on the layout the list reverts to its unsorted state. Do I need to add a step to every script to make sure the list stays in sorted order?

1712613818_RelationshipDiagram.jpg.ffa8f04996c611aff318070d825659e8.jpg

Link to comment
Share on other sites

I am confused because your title says "Sorting a portal.." but then you speak about sorting a list - apparently the list of records in the Products table, as seen in List view?

I am also not sure what are the "other things" that cause your records to become unsorted. Am example or two might help us understand the problem.

 

Edited by comment
Link to comment
Share on other sites

2 minutes ago, comment said:

I am confused because your title says "Sorting a portal.." but then you speak about sorting a list - apparently the list of records in the Products table, as seen in List view?

Hi, I'm sorry for not being more clear. The layout based on products is a form view, and the layout contains a portal to display those records. Since the portal draws from the same table as the layout, I don't have the option to sort or filter it.

I have a script to sort the records on layout enter, and it works. However, if I enter find mode to constrain the record set, the list becomes unsorted again after I 'show all'. Screenshot below looks near the bottom of the list:

1860978170_PortalUnsorted.jpg.33278986c5f84bac1999056a0ca22c5e.jpg

 

Link to comment
Share on other sites

19 minutes ago, RavingLuhn said:

if I enter find mode to constrain the record set, the list becomes unsorted again after I 'show all'.

Constraining the found set does not change the sort order. Showing all records does. At what point of constraining the found set would you need to use Show All Records, and for what purpose?

 

Link to comment
Share on other sites

31 minutes ago, comment said:

At what point of constraining the found set would you need to use Show All Records, and for what purpose?

I can think of quite a few reasons, but it could be that I'm not approaching the issue from the right mindset. Here's a standard scenario:

  1. I want to look at our product list and review their status for this year and next year, so I go to the layout above. Upon loading the layout, a script runs to ensure the records (and thereby, the portal) are sorted by product name.
  2. There's only one product or group of products I need to review, so I enter find mode to narrow down the records displayed. Potentially, I even perform a find for the year and the specific status.
  3. When I've reviewed the information, I need to get back to the full list of products, so I select 'show all' from the top navigation bar.

Would I be better suited adding controls to my layout instead of relying on the 'show all' button on the default top navigation bar?

Link to comment
Share on other sites

48 minutes ago, RavingLuhn said:

When I've reviewed the information, I need to get back to the full list of products, so I select 'show all' from the top navigation bar.

This is where you will lose your sort order. You could prevent this by using a script instead of the built-in command - a script that shows all records and sorts them. You can run the script using your own button, or from the Scripts menu, or - if you take the time to create a custom menu set - using the same button as before.

Alternatively, you could perform the find in a new window, and return to your original, already sorted, full set by closing the current window.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.