Function IIF
Function IIF is similar to the conditional statement if - then – else.
Header
function IIF(Expr: Boolean; TrueValue, FalseValue: Variant): Variant;
Function GetFormValue
The GetFormValue function returns the value in the object in the program window. Its argument is the name of the object in the window along with the name of the window. If an object does not exist or a form is not created, the function returns an empty string.
Header
function GetFormValue(FormComponentName: String): Variant;
An example of using the IIF function
The next example of using the IIF function is on the 22G report, which can be found in the program in the Goods | VAT menu only for Croatian legislation. The term first displays the name of the subject. If a VAT number is also entered, it will also print it in the new line. For the transition to the new line, the character sequence LF (No. 13) and CR (No. 10) was used.
[IIF(<qReportIzpis."acCode"> = '', <qReportIzpis."acSubject">,
<qReportIzpis."acSubject"> + Chr(13) + Chr(10)+ <qReportIzpis."acCode">)]
If nesting the IIF function, it quickly becomes opaque (non-transparent), so it's better to replace it with the if statement in the code. A code equivalent to the above expression is
procedure Memo19OnBeforePrint(Sender: TfrxComponent);
begin
if (<qReportIzpis."acCode"> = '' then
Memo19.Text := <qReportIzpis."acSubject">
else
Memo4.Text := <qReportIzpis."acSubject"> + Chr(13) + Chr(10)+ <qReportIzpis."acCode">;
end;