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.

Using CASE in a script

Featured Replies

Can I use a CASE statement in a script using the SET FIELD command instead of a series of IF statements

Cheers

Nick

CASE does not exist as a SCRIPT step. The only conditional scripting control is the IF/ELSE steps.

Indeed you can, Nick!

The Case ( ) function, used within a Set Field command will in some instances provide for a much more compact script sytax - where, for example, the following sequence:

If ["IsEmpty(EventDate)"]

Set Field ["WhenHappens.txt", " "Unknown" "]

Else

If ["EventDate" < Status(CurrentDate)"]

Set Field ["WhenHappens.txt", " "Already Over" "]

Else

If ["EventDate" = Status(CurrentDate)"]

Set Field ["WhenHappens.txt", " "Today!" "]

Else

If ["EventDate" > Status(CurrentDate)"]

Set Field ["WhenHappens.txt", " "Not Yet..." "]

EndIf

EnfIf

EndIf

EndIf


Can be achieved rather more neatly with a single step, using the following:

Set Field ["WhenHappens.txt", "Case(IsEmpty(EventDate), "Unknown", 

EventDate" < Status(CurrentDate), "Already Over",

EventDate" = Status(CurrentDate), "Today!", "Not Yet..." "]


There are many uses for this technique.

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.