Could not convert variant if type (Array Variant) into type (OleStr)
Hi
I am currently getting the following error message "Could not convert variant if type (Array Variant) into type (OleStr)" while trying to execute the following code within a Memo:
[([IIF(<frxDBDataset2."MEM_ID"> = '',VarToStr(<frxDBDataset2."DEP_PASSPORT">),VarToStr(<frxDBDataset2."MEM_ID">))])]
I am trying to create a MasterDetail report, where in the Detail, the memo needs to see if the current record has an ID Number, if they do, it must print the ID Number, if not, it must print a Passport Number for me.
There is no documentation or any examples in the User's Manual, Developer Manual, or Programmers Manual on how to use any of the functions within FR5 VCL and the explanations at the bottom of the Expression Editor is sometimes very vague.
Can someone please help and explain what I need to do and change to make this work?
Using Delphi 10 Seattle with FastReports5 VCL Embarcadero Edition.
Thanks.
I am currently getting the following error message "Could not convert variant if type (Array Variant) into type (OleStr)" while trying to execute the following code within a Memo:
[([IIF(<frxDBDataset2."MEM_ID"> = '',VarToStr(<frxDBDataset2."DEP_PASSPORT">),VarToStr(<frxDBDataset2."MEM_ID">))])]
I am trying to create a MasterDetail report, where in the Detail, the memo needs to see if the current record has an ID Number, if they do, it must print the ID Number, if not, it must print a Passport Number for me.
There is no documentation or any examples in the User's Manual, Developer Manual, or Programmers Manual on how to use any of the functions within FR5 VCL and the explanations at the bottom of the Expression Editor is sometimes very vague.
Can someone please help and explain what I need to do and change to make this work?
Using Delphi 10 Seattle with FastReports5 VCL Embarcadero Edition.
Thanks.
Comments
[IIF(<frxDBDataset2."MEM_ID"> = '', VarToStr(<frxDBDataset2."DEP_PASSPORT">), VarToStr(<frxDBDataset2."MEM_ID">))]
Thank you very much, that worked perfectly. But i see it is exactly the same as my code, except mine has 2 extra brackets at the beginning and end, so why didn't mine work?
How do I use this code for Dates?
[IIF(<frxDBDataset2."MEM_DATERESIGNED"> = '', VarToStr('Current'), VarToStr(<frxDBDataset2."MEM_DATERESIGNED">))]
As I get this error message: "Could not convert variant if type (UnicodeString) into type (Double)"
Thank you very much, just forgot to use TO_CHAR in my query for my dates and convert it to a string value.