Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5274 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

This seems like the easiest thing in the world to do, but for some reason I am unable to script a sort of a set of related records via a portal row.

What I want to do is have a portal that, upon record creation, displays the order that the records are created in. After the user closes the window, any subsequent time that they go into the layout to view the child records I want a script to sort the records contained in a portal by name. For some reason trying to manually sort the records using ctrl+s or by using the Sort Records script step is not working. The only way that I can sort the records is by actually going into layout mode and selecting "Sort Portal Records".

What am I missing here?

Posted

This is a job for Two Portal Man! Or Multi-Portal Man! [Note that you can substitute Woman for Man.]

Create the portal layouts that sort as you like, note that portals sort best when done at the TO level.

Now create a tab layout with sufficient tabs to hold your various portals. You can name the tab as your desired sort.

If you are so stubborn that you don't want the tabs to show, make them invisible and name each tab and use go to object(tab name) in your script and the prefered layout will pop to the top while the others remain hidden.

Or you can fake a sort button and use it to go the the tab object.

Posted

create 2 fields

a global g_sort to act as the switch, a calc to return record values based on the switch

sort on the calc

add a step into the new_record script to set the global to "id"

or define a script trigger attached to the layout onrecord load to do similar for other situations

define a calc in the data table to evaluate the global, and return the values that will be used to sort:

c_sort_value = If(g_sort = "id"; category_id; category_name)

This needs to be a calc, an auto enter calc will not evaluate correctly (i.e. all records); curiously.

define the portal sort to sort on c_sort_value.

The sort re-trigger needs a refresh step; so if you add a button to the layout to allow user sort by optional values (global + VL) add a script trigger to the global to script execute a refresh

This topic is 5274 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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