Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Moving Portal Rows Up and Down

Featured Replies

I have a portal that displays a list of documents and has 2 buttons: one to move a document up one row, and another to move a doc downone row. The portal is sorted based on Sequential # (number field). The scripts work for a number of moves and then one or the other screws up, but not always the same one. I can't figure out why.

Could the portal rows get changed (resorted) by FM before the script terminates so that I'm not on the row I think I am? Does anyone see what I'm doing wrong?

_iloc and _ipos are global number fields.

Move Sale Document Up:

Set Field [ _iloc, Status( CurrentPortalRow) ]

If [ _iloc = 1 ]

Halt Script

End If

Go to Portal Row [ _iloc ]

[ By Field Value... ]

Set Field [ Sale Documents Portal::Sequential #, Sale Documents Portal::Sequential # - 1 ]

Exit Record/Request

Set Field [ _iloc, _iloc - 1 ]

Go to Portal Row [ _iloc ]

[ By Field Value... ]

Set Field [ Sale Documents Portal::Sequential #, Sale Documents Portal::Sequential # + 1 ]

Exit Record/Request

Go to Portal Row [ _iloc ]

[ By Field Value..., Select entire contents ]

Move Sale Document Down:

Set Field [ _iloc, Status( CurrentPortalRow) ]

Go to Portal Row [ Last, Select entire contents ]

Set Field [ _ipos, Status( CurrentPortalRow) ]

If [ _iloc >= _ipos ]

Halt Script

End If

Go to Portal Row [ _iloc ]

[ By Field Value... ]

Set Field [ Sale Documents Portal::Sequential #, Sale Documents Portal::Sequential # + 1 ]

Exit Record/Request

Set Field [ _iloc, _iloc + 1 ]

Go to Portal Row [ _iloc ]

[ By Field Value... ]

Set Field [ Sale Documents Portal::Sequential #, Sale Documents Portal::Sequential # - 1 ]

Exit Record/Request

Go to Portal Row [ _iloc ]

[ By Field Value..., Select entire contents ]

Sure, I think I see your problem... Look closely at the script, for a moment, lets say, for instance you are moving item 4 to be item 3, and thus item 3 to be item 4:

First you say, basically, Go To Item 4

Then, Change Item 4 to be Item 3

Then, Go to Item 3 - BUT! You have two seperate records that have a sequence of 3 for that moment - the old 3 and the new 3. This is a big problem, because that means FMaker is going to grab whatever item 3 it decides should be 3rd in the sort, usually whatever one was created earlier. A better solution might be, to make item 4 into item 3.5, then make item 3 item 4 then make item 3.5 item3.

Make sense? This might not be the ONLY prob, but its definitely one I see.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.