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

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

Recommended Posts

Posted

Hi

I am using an If function in a script where i wish the outcome based on two possible entries in a field. For example I wish an action to happen if the Status field in the Customer table equals M2 or TBR. I have tried the calculation Customers::Status ≠ "M2" xor "TBR" and a number of other possible variations. Can anyone let me know where I am going wrong.

Posted (edited)

Try this:

If [ Status = "M2" or Status = "TBR" ]

#do something

End If

Just saw the comment, "and other possible variations." Why don't you explain further. You may need to set a flag field that describes the state of the record, and use that in your If script statement.

Edited by Guest
added more
Posted

Hi thanks that does work. The problem I am having is when I turn it around to being not equal to. When I change the formula from Customers::Status = "M2" or Customers::Status = "TBR" (Which works) to Customers::Status ≠ "M2" or Customers::Status ≠ "TBR" is does not perform as expected, ie performing the action when the status field is not M2 or TBR. The formula does work however it it is just one result eg. Customers::Status ≠ "M2"

Posted

I have made this work by changing the code to the following:

(Customers::Status = "M2" or Customers::Status = "TBR") = False

Posted

That is not a valid calculation. Two not equals doesn't work because it may always be true.

What is the complete test?

Posted

I not sure what you are trying to do, but have you tried the Else If statment?

If ( Customers::Status = "M2" )

Do something

Else If (Customers::Status = "TBR")

Do something

Else If (Customers::Status = "X")

Do something else

Posted

(Customers::Status = "M2" or Customers::Status = "TBR") = False

That is not a valid calculation.

Of course it is. It's not only valid, but also correct. It's the same as:

not ( Customers::Status = "M2" or Customers::Status = "TBR" )

which could also be written as:

Customers::Status ≠ "M2" [color:red]and Customers::Status ≠ "TBR"

Posted (edited)

(Customers::Status = "M2" or Customers::Status = "TBR") = False

But isn't that asking: ( 1 ) = False or ( 0 ) = False

It would always fail. IIRC, false hasn't been boolean 0 since vs. 6; along with F & N & no. False is no longer not, no?

Edited by Guest
Posted

Let's not get confused here. Text values like "Y", "N", "T", "F", "True" and "False" are no longer evaluated as Boolean. But the reserved keywords True and False can be used in a calculation formula instead of 1 and 0.

Posted

Oh, right! Not sure why I saw "False" when Barbara said it wasn't valid; maybe she saw it same way I did. Without quotes, it is certainly valid! Thanks for the reminder, Michael.

Posted

Customers::Status ≠ "M2" and Customers::Status ≠ "TBR"

That is a construct I do use, although I prefer to write in positive case when possible. I'm not familiar with the use of False, my apologies, it just looked so wrong. It certainly doesn't read as well to me.

Anywho, I think that Lee's suggestion is probably the way to go if the tests are numerous. But since we don't have enough info, it's just guessing at this point.

This topic is 6068 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.