nelliott Posted October 3, 2002 Posted October 3, 2002 Can I use a CASE statement in a script using the SET FIELD command instead of a series of IF statements Cheers Nick
IdealData Posted October 3, 2002 Posted October 3, 2002 CASE does not exist as a SCRIPT step. The only conditional scripting control is the IF/ELSE steps.
CobaltSky Posted October 3, 2002 Posted October 3, 2002 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.
Recommended Posts
This topic is 8091 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now