Skip to Content
0

Wrong results when I compare strings in a formula in Cristal Reports

Jun 15, 2017 at 03:15 PM

27

avatar image

Hello All!

String comparison in a formula always returns false. Next code for example:

IIF ({Root.ATTR_ST_ELEK} = '-1', stringVar sVar := 'yes', stringVar sVar := 'no');
sVar

sVar is always 'no'.

My Data Source here is a XML file, and Root.ATTR_ST_ELEK is a node in the file.
I use CR for VS 2010.
It seems like a novice question, but I really can not make it work. So, please, what's wrong? Any suggestions?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Don Williams
Jun 15, 2017 at 03:27 PM
1

Hi Alexey,

You were close, try this, you can't assign a variable within the logic part:

stringVar sVar; // define the var
sVar := IIF ({Root.ATTR_ST_ELEK}='-1' , 'yes', 'no'); // evaluate
sVar; // return the result

Don

Share
10 |10000 characters needed characters left characters exceeded
Alexey Shakin Jun 16, 2017 at 09:13 AM
0

It works! Thanks!


Too bad, I could not find any help or guide on the subject.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Alex,

Too bad you did not hit the F1 key and use the built in help that comes with Crystal reports.... lol

That is all I did.

Don

0

Hi, Don

It's not so easy! Neither I'm so dumb! :)

I use CR for VS 2010, and a hit of F1 just opens VS 2010 Home Page on msdn web site.

Thanks, though. Now I know that there is such help in the standalone version of CR.

0