Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8558 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I can't seem to get the if statement to work for the Status (CurrentMessageChoice). I have created a message with the two responses OK and Cancel. I am using the following if statment:

If ("Status(CurrentMessageChoice = "1")") I have also tried If ("Status(CurrentMessageChoice = "true")") I can't seem if satisfy the IF statement. Help.

Posted

Hello Karen,

be sure you are testing the right button: they are numbering starting from the rightmost (1) to leftmost(2, in your situation).

Greetings.

Posted

Right, you don't need the quotes around the "1". Also remember how status tests work. You can only perform a valid status test in the next script step. For example:

Show Message ()

If (Status(CurrentMessageChoice) = 1)

If you test later, for example:

Show Message()

If (Status(CurrentMessageChoice) = 1)

Perform Script()

End If

If (Status(CurrentMessageChoice) = 2) <--- INCORRECT

Perform Script()

Is not a valid way to perform a test. The results of the "Show Message" script step stored as a status can be altered by status results of following script steps. The dangerous part of this is that sometimes you can get away with it, only to have it fail in another script with a step that sets status. This can create problems that are hard to find. The proper way to test message choices if you need more than one test is to store the status result of the "Show Message" step in a global number field (call it gStatus). For example:

Show Message()

Set Field (gStatus, Status(CurrentMessageChoice))

If (gStatus = 1)

Perform Script()

End If

If (gStatus = 2) <--- CORRECT

Perform Script()

-bd

Posted

Boy am I glad I checked here - I have loads of scripts with incorrect Show Message status scripts all testing the status sequentially, but somehow I've never been caught out.

Live Oak, can you please give an example of a "script with a step that sets status" and how it would cause a problem? I'm not sure what to specifically avoid.

Thanks!

Posted

Pretty much any action script step that can fail generates a status. Delete record might fail if you don't have proper privileges, for example. This best idea is to write scripts to avoid the problem. If is too easy to add a script step without reviewing to see if status is generated. It's kind of like asking which roads are not used very often so you can drive on the wrong side! Take a look at the status codes and this will give you some idea of the variety of possibilities.

-bd

This topic is 8558 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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