If you use a sorted portal or sorted relationship that sorts on the values in a number field in the portal's table, you can move rows up and down by changing the values in that field. The field need not be visible and need not store discrete integer values. WHen you click a button to move a row up or down, the script can use getNthRecord to access the preceding or following records' sort field values to use in computing a value that moves the row where you clicked the button up or down. (I use the midpoint theorem for that calc.)
Phil. Thanks for the fast response.
So it sounds like I need a field for sorting. And use getNthRecord to get the sort value from the sort field.
What do you mean by "midway theory for calc"?
I said midPOINT theroem. This is a standard mathematical formula for calculating a value that is halfway between two other values. The mid point between A and B is (A + B ) / 2. So you use GetNthRecord to access the values for A and B, add them and divide by 2. Assign this value to the sort field of the portal row you want to move to be between A and B. This requires special code for when there is only one record above (when moving record up a row) or one record below ( when moving record down a row).
The fact that you get decimal values in your sort field will not keep this from working.
So I got my portal rows to move up and down.....works as needed
But now a printing issue. My printing layout is set up in as a list.....Header, Body & footer.
So it's printed according to creation of the record and not according to my sort.
Any work around this?
Sort the records on you print layout using the same criteria specified for your portal.
Thanks Phil, that fixed the issue.
In FM10 Is there a way to control whether Header prints on only the first page?
You can change it into a Title Header and then it only prints on the first page. In layout mode, double click the part label for the header to open part setup...