I am trying to create a new Fast Report 4.0 embedded report from scratch due to previously supported SAP Crystal reports being deprecated.

Why don't conditional functions seem to ever work with user made variables or even with query defined fields? In my masterdata I have a memo field for troubleshooting

[IIF(1 = 1, query1."field1", 0)]

the brackets should let the IIF be evaluated and always return me my field1 but the report breaks with the error:

The following error(s) have occured: Memo29: Error in expression 'IIF(1 =1, query1."field1", 0)': ')' expected»

This doesn't work so of course neither does something like

[IIF(query1."data1"> = <PrevYear>, <s1query1."NET">,0)]

where is my variable in my 'Report Variables' folder that is set to 1 for example. What am I doing so terribly wrong, it seemes that I'm obviously not missing any parentheses nor am I forgetting the brackets.. Please don't newbiebomb me, I have genuinely looked into everything and anything for a solution, attempted using the Fast report's own forum to no avail (I get an error when trying to post as an anonymous user or even when attempting to sign up)..

[Tried using the conditional functions in text memos as described in the documentation and Fast report forums

e.g.:

[(IIF 1=1, myquery."myfield", myquery."myOtherField")]

this doesn't work]

2

There are 2 best solutions below

3
Brian On

I only see that error if there is an extra comma in the IIF part of the expression. The expression below works fine in a memo dropped on a report here and shows up as Test2 in report preview.

[IIF(FALSE,'Test','Test2')]
0
user23370532 On

I found the solution, for my implementation of Fast Report, the equality comparator in FAST functions is not = as noted in the documentation and mentioned in the Fast Report Forums but rather == so

[IIF(1=1,1,0)]

doesn't work but

[IIF(1==1,1,0)]

works..