@If not working

My @If works fine but one part does not work. This field determines what view the doc goes into. I have 8 other statements in the @If and they work but this one does not.

@If(field1 = “Yes” & field2 = “Yes” & Cost <= “10000.00”; “Approved”)

Thanks…

Subject: @If not working

From what I can see you are missing the section that determines what happens if the @if fails?

@If( condition1 ; action1 ; ELSE_ACTION )

Susan

Subject: AND… @If not working

You need to specify numeric values without the quotation marks.

Cheers,

Mark

Subject: RE: AND… @If not working

Thanks to both…I’ll try that.

I have the else part…just need to take the quote off.

Sorry I didn’t post the whole code… :expressionless:

Subject: RE: AND… @If not working

When I took the quotes off the 10000.00, many entries disappeared, but they showed in the “All” view.

Here is the message that showed in the “Status” field:

ERROR: Comparison operators must be supplied two values of the same data type

@If(field1 = “Yes” & field2 = “Yes” & Cost <= 10000.00; “Approved”;“Pending”)

Subject: RE: AND… @If not working

Post the entire code… then we could likely help you.

PS. You don’t need to put 10000.00 → 10000 instead

Mark

Subject: RE: AND… @If not working

Here is the entire code. The number part is messing it up.

@If(field1 = “Yes” & field2 = “No”; “Declined”;

field1 = “Yes” & field2 = “Yes” & Cost <= 10000; “Approved”;“Pending Approval”)

Subject: RE: AND… @If not working

Make sure that Field1 contains text, Field2 contains text, and Cost contains a number.

Subject: RE: AND… @If not working

I’m using this for my view selection.

It’s working now but the status bar shows the message ERROR: Comparison operators must be supplied two values of the same data type. This shows only for approvals, where the number is.

@If(field1 = “Yes” & field2 = “No”; “Declined”;

field1 = “Yes” & field2 = “Yes” & Cost <= 10000; “Approved”;“Pending Approval”)

Subject: RE: AND… @If not working

Try using @ToNumber to insure that Cost is compared as a number.

@If(field1 = “Yes” & field2 = “No”; “Declined”; field1 = “Yes” & field2 = “Yes” & @ToNumber(Cost) <= 10000; “Approved”;“Pending Approval”)

Subject: RE: AND… @If not working

The problem is likely that some of the documents do not have numeric values for Cost. This most commonly happens when a numeric field such as Cost has no default value, so its default value is left as “” rather than 0.0. It can also happen when some documents have no Cost item at all (you can tell by looking at document properties from the view, not from the document), as that will also default to “”. You could fix this a number of ways, but you could test it by changing your formula to:

@If(field1 = “Yes” & field2 = “No”; “Declined”; @Text(Cost) = “”; “No Cost”;

field1 = “Yes” & field2 = “Yes” & Cost <= 10000; “Approved”;“Pending Approval”)

Subject: @If not working

Other than the missing ELSE condition, I don’t like … Cost <= “10000.00”

If cost is numeric, lose the quotes. Because “12” > “10000.00” when comparing strings.