What is wrong with the C# expression

I have a really simple if/then statement in a BPM Set Field

(dsCustomerRow.Country == "United Kingdom") ? 1 : 2;

But I keep getting the error ‘BPM003 Expression should contain only one statement’

I don’t know what is wrong with the code; to me, it is only one expression.

All I can think right off the bat is that it might not like the semi-colon at the end of the expression.
Otherwise, it definitely evaluates to a single int value…

4 Likes

if it’s not the semicolon like @jwphillips said, sometimes, depending on where you are doing this, you can use something like:

return ((dsCustomerRow.Country == "United Kingdom") ? 1 : 2);
2 Likes

The BPM set field is already assuming the ; at the end. So when you added that in, it’s thinking that there 2 statements. If you remove that, you should be fine.

3 Likes

Thank you

2 Likes