7 Replies Latest reply on Oct 23, 2014 10:51 AM by philmodjunk

# Move portal rows up or down as needed.

### Title

Move portal rows up or down as needed.

### Post

I am using FMP10.

Is there way to move a portal row up or down as needed?

At times I need to move a line item next to another which was entered earlier or move a line item further down the list.

Thanks -J

• ###### 1. Re: Move portal rows up or down as needed.

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.)

• ###### 2. Re: Move portal rows up or down as needed.

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"?

• ###### 3. Re: Move portal rows up or down as needed.

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.

• ###### 4. Re: Move portal rows up or down as needed.

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?

-J

• ###### 5. Re: Move portal rows up or down as needed.

Sort the records on you print layout using the same criteria specified for your portal.

• ###### 6. Re: Move portal rows up or down as needed.

Thanks Phil, that fixed the issue.

In FM10 Is there a way to control whether Header prints on only the first page?

• ###### 7. Re: Move portal rows up or down as needed.

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...