Simple one (I thought)

This is what is in an action…simple really. I put the formula near the bottom here, and an explanation of what I am trying to do first…

1.) Check the Type field (text). If it is “Maintenance”, enter “Yes” into x.

2.) Check the DiscountPct field (Number). If it is greater than zero, enter “Yes” into y

3.) Check to see if both the above conditions are true. If so, enter “Yes” into z

The results:

Prompt x = "Yes

Prompt y = "Yes

Prompt z = <empty…nothing>

Why would this be? I thought the ampersand (&) would do just fine, but it is failing me. Is it because I am testing a string and a number in the same formula?

x:=@If(Type = “Maintenance”;“Yes”;“No”);

y:=@If(@ToNumber(DiscountPct) > 0;“Yes”;“No”);

z:=@If(Type = “Maintenance” & @ToNumber(DiscountPct) > 0);“Yes”;“No”;

@Prompt([Ok];“type”;x);

@Prompt([Ok];“discountpct”;y);

@Prompt([Ok];“together”;z)

Thanks to anyone who can restore my sanity here.

Additional info: Doc properties shows DiscountPct as a Number List. That has always been a curiosity to me.

Field Type is actually “Maintenance”

Field DiscountPct is actually 0.05

  • Matt

Subject: simple one (I thought)

Hi,

Try out with the code below.

x:=@If(Type = “Maintenance”;“Yes”;“No”);

y:=@If(@ToNumber(DiscountPct) > 0;“Yes”;“No”);

z:=@If( (x = “Yes” & y = “Yes”);“Yes”;“No”);

@Prompt([Ok];“type”;x);

@Prompt([Ok];“discountpct”;y);

@Prompt([Ok];“together”;z)

Subject: simple one (I thought)

Is this a typo or the reason for your error:

z:=@If(Type = “Maintenance” & @ToNumber(DiscountPct) > 0);“Yes”;“No”;

Should be:

z:=@If(Type = “Maintenance” & @ToNumber(DiscountPct) > 0;“Yes”;“No”);

Subject: simple one (I thought)

Don’t know if this is your problem, but you have a missing bracket after the z:=@if(…;“Yes”;“No”;

Should be a bracket after the “No”