Problem using IIF

edited November 2018 in FastScript
Working on fastreport 6.2, I have to use fastscript within one of my projects.
I then created a runtime instance and started everything as you see in this example:

FScript:=TfsScript.create(nil);
FScript.SyntaxType:='PascalScript';
FScript.AddRTTI;


It happens that when I go to do the evaluation of an expression that contains the IIF function, this always returns to me zero.
For example, if I write:

FScript.Evaluate(IIF(1>0,1,2))

This return always 0, and if I insert this:

FScript.Evaluate(IIF(1>0,1,2)+5)

The result is 5.
It seems that the IIF function is never resolved and always returns 0.
I also tried to insert everything into a script so I can compile and execute it but the result is the same, the IIF function always returns 0.
At the moment to solve this I simply created a new function that does the same thing as the IIF and for the moment it works, I wanted to understand why this happens, because using IIF in a Fastreport document, this works perfectly so I'm afraid the problem depends on how I use the Fastscript object!

Comments

  • edited 10:32AM
    I realized that there was already an answer to this question, but I had to scroll through all the posts to find it because with the search, looking for IFF, nothing came out!
    The problem depends on the fact that the IIF function is not defined in Fastscript!

  • gpigpi
    edited 10:32AM
    Yes, IIF is defined in the Fast Report

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.