Problem using IIF
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!
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
The problem depends on the fact that the IIF function is not defined in Fastscript!