Invalid variant type conversion...
I'm having trouble with variables on FastReport...
I added the function AnsiReplaceStr to my FastReport, using the AddFunction method and the OnUserFunction event... It appears to be added correctly, but when I tried to call the function, I get the error "Invalid variant type conversion"...
This error appears for me everytime I try to use a variable on FastReport...
I created a variable on Fast and I tried to use it that way:
But the error appears here too...
Finally, how to use variables on FastReport? Where is my error?
Best regards.
I added the function AnsiReplaceStr to my FastReport, using the AddFunction method and the OnUserFunction event... It appears to be added correctly, but when I tried to call the function, I get the error "Invalid variant type conversion"...
This error appears for me everytime I try to use a variable on FastReport...
I created a variable on Fast and I tried to use it that way:
procedure MemoCliOnBeforePrint(Sender: TfrxComponent);
Var wI : Integer;
begin
  MemoCli.Memo.Clear;
  MemoCli.Memo.Add( 'A' );
  For wI := 1 To StrToInt( Copy( VarToStr( <wCliSpaces> ), 1, 2 ) ) Do
    MemoCli.Memo.Add( ' ' );
End;
But the error appears here too...
Finally, how to use variables on FastReport? Where is my error?
Best regards.
Comments
Regards,
Gabriel Frones
A fragment of my code should help?
regards.
I make some tests, and the error appears to happens only with variables sent by Delphi or already existing on the Report.Variables... There are any diferences on the Reading of procedure's variables and the report's variables?
regards.
It shows the error "Invalid variant type conversion", but if I remove the two last lines, there are no errors... Why is FastReport Trying to convert Variant, if everything is already on the necessary types?
regards.
Try to convert the string '0012' to variant and back to string... It will return '12'... Using the Copy function on FastScript (that converts to Variant), if you do a Copy( var, 1, 2 ), the expected result is '00', but it will return '12', theorically... I couldn't make it works, yet...
regards.
Now I wonder.... For what does FastReports have a Script if it's VERY hard to use a variable?
regards.
If FastScript wasn't a product they sold then I'd suggest using PascalScript which is much closer to Delphi than FastScript is.
regards.
works well for me - prints 00.
If there's something wrong, how can I correct? Can I uninstall and reinstall the Update packs?
Thank you very much, Alex!
regards.
Thank you very much!
regars.