Skip to Content

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

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 15, 2017 at 03:27 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 16, 2017 at 09:13 AM

    It works! Thanks!


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

    Add comment
    10|10000 characters needed characters exceeded

    • 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.