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

Shuffling the cards, Hanoi towers, or something

Featured Replies

I have 4 fields, A, B, C, and D. Sometimes one or more of them is empty. I want to make a script that shuffles them around so that the empty ones are always last. That is, if A is empty but B has a value, I want to move the value to A and clear it out of B.

Anyway, the caffeine isn't helping today, and I wonder if someone has a semi-elegant way of doing this, in a loop maybe -- but Exit Loop If ... what?

Just a bunch of If's would work, but maybe not too elegant.

If (IsEmpty(A))

If (notIsEmpty(:)

SetField(A, :

SetField(B, "")

Else

If(notIsEmpty©)

SetField(A, C)

SetField(C,"")

Else

If(notIsEmpty(D))

SetField(A, D)

SetField(D, "")

End If

End If

End If

End If

If (IsEmpty(:)

If (notIsEmpty©)

SetField(B, C)

SetField(C,"")

.

.

.

I'm tired of typing, but you get the idea.

-bd

If you like the idea of automatic shuffling, check out this attachment.

I just did it to see if it was possible, after reading your post. Turns out that it is! smile.gif

Note: updated example to exclude data fields consisting of only " " or par.gif

shufflefields.zip

  • Author

Thank you both for the help. -Q-, that's a very, very clever solution. It's a little more than I want to get into though, since I actually need to move a whole row of 5 fields, some of which already have other lookups. LiveOak, I also got tired of typing -- I was staring at my script, similar to yours, and just thinking there must be a better way. This morning I had a small inspiration, so now I have a pseudo-loop in which the script calls itself after each move, and I only need 3 IFs:

IF ( IsEmpty(A) and not IsEmpty(: )

.. SetField(A, B)

.. SetField(B, "")

.. Perform Script (this script)

End IF

#

IF ( IsEmpty(B) and not IsEmpty© )

.. SetField(B, C)

.. SetField(C, "")

.. Perform Script (this script)

End IF

#

IF ( IsEmpty© and not IsEmpty(D) )

.. SetField(C, D)

.. SetField(D, "")

.. Perform Script (this script)

End IF

#

Hey, I like that idea, too. More thinking outside the box, which is too much fun for me to handle. smirk.gif

I wonder if you could use my idea, but base the lookup on a calculation between the Get Field and original lookup fields. Hmmm.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.