Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Portal Sorting


Leoff

Recommended Posts

Two portal sorting questions actually...well, three questions with two about sorting;

1-How can I sort columns within a portal using a column header?

2-How can I reverse the above sort (ascending vs. decending) using the same column header?

3-...and, How can I access one of the records from within the portal? I have attempted a 'typical' script with no success...when I create a button all I get is the current record showing in the main fields at the top of my screen...

 

Much thanks...

 

Leoff smirk.gif

Link to comment
Share on other sites

...well, in reality I only need one column sorted at a time. I would have up to eight columns in the layout however. I'm hoping for a simple solution more like a script to sort on the go...so that any chosen column could be sorted either ascending or descending...

Link to comment
Share on other sites

As far as I know you can set a portal to sort by only one field or hierarchy of fields at a time. If you want to script the choice of sort then I think you can create a number field, set portal sort order for this field, and then set sort scripts as follows:

 

1-go to related records

2-sort specified by field of choice

3-replace contents by a serial in the new number field.

4-go to original layout and record

 

this procedure applies to one sort, so make a script for all fields in the portal you wish to select. I don't think you can pass the field of choice as a script parameter.

 

it could get you in trouble in a multi user environment (as multiple users might choose conflicting columns.

 

may take a few seconds to run if the number of related records is large.

 

kjoe

Link to comment
Share on other sites

kjoe, much thanks! Your solution looks interesting as I just took a peek at it. I am using FM7, but opened it in 5.5 to view it. I will dive into it more within the next couple of days when I have more time, but will incorporate it in my solution unless I hear of an 'easier' method. But, you did a nice neat job, thanks for sharing! I especially like the use of color added into the sort...

 

Do you have a solution for my other concern? About how to choose only one specific record from within the portal? That would also be of great assistance...

 

Much thanks!

 

Leoff smile.gif

Link to comment
Share on other sites

that was -queue-'s sample not mine. I could not in my wildest dreams have thought up a calc like Sortopolis. My sorts'r'us suggestion above is much more mundane.

 

 

anyway, I believe the sample -queue- posted from databasepros solves 1 and 2. If you really want only one button, set up a toggle:

 

if[ToggleValue=1]

#sort ascending

set field[Togglevalue, 0]

else

#sort descending

set field[ToggleValue,1]

end if

 

ToggleValue then is used down the line to determine ascending or descending and a picture calc in the column header:

HeaderIcon=container calc=case(ToggleValue=0;SortIcons;getRepetition(SortIcons;2))

 

 

as for 3, you can use a go to related records script step from the portal row.

 

kjoe

Link to comment
Share on other sites

...whoops, indeed I meant to offer credit where credit was due. But, certainly your solution is more of what i have been asking for, less of a workaround much less! I knew there was a cleaner way! So, NOW I thank you!!!

 

Will test it tomorrow most likely! Much thanks!

 

Leoff smile.gif

Link to comment
Share on other sites

Leoff,

 

thanks but keep in mind my worry that solutions to this that rely on changing a field value to change sort order will get you in trouble in multi-user. I guess the same holds true for sortopolis. So about the only thing you can do for a multiuser setup is make multiple portals on multiple layouts and navigate between them. Much like aaa suggested.

 

When in single user you can of course take the scripted or calculated solution. Then think about speed. My scripted solution will operate only on the related records. Sortopolis is an unstored calc that acts across the whole file. Nevertheless, I think unless the file is becoming really big, Sortopolis will perform better in most cases.

 

a really quick and dirty solution might be to drop the portal idea altogether and simply go to related records in table view, clicking on the column headers there will toggle sort order for the field in question. Just put a go-back button in the header to navigate back to the main file.

 

kjoe

Link to comment
Share on other sites

[ QUOTE ]

about the only thing you can do for a multiuser setup is make multiple portals on multiple layouts and navigate between them.

 

[/ QUOTE ]

 

Is it? If a calculation field depends for its value on a global field - isn't the (unstored) result different for each user?

Link to comment
Share on other sites

Yes and no. The basic principle is sound, but the implementation...

 

For one thing, I find the method of "reverse-mapping" characters (a to z, and vice versa) entirely unacceptable. English is not the only language in the world (as I suspect you know very well).

Link to comment
Share on other sites

Have two calc fields: one of them is always empty. Which field is empty is determined by gSortOrder. Sort the portal by both fields, one in ascending order, the other in descending.

Link to comment
Share on other sites

  • 6 months later...

So let's say I have a single portal, and want to sort by each of the 6 different columns, how do I go about that? I have looked at all the conversations, but none of the so called attached files seem to be attached, so I don't know what they are all talking about. I know you can sort a portal when you set it up, but how can I have users sort it by specific columns on the fly?

-Ryan

Link to comment
Share on other sites

You can use a calc with getfield() on a global that holds the name of the desired sort field. Have the portal sort by this calc. See the attached demo.

 

Note that if the sort fields include a mix of field types, the types will need to be converted so that they sort properly (i.e. date, time, and number data does not sort correctly when placed into a text field, it needs to be numbers with leading zeros.)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use