Variable with String Values?

edited 10:35AM in FastReport 4.0
Probably a stupid question but I can't find an example showing how to do this.

I have some varaibles I've declared myself in Delphi via AddVariable(). Numbers, dates etc are ok but string variable give me errors:

If there isn't a space in the variable content I get: "Undeclared identifier"
or
or if I have a space in the text I get: "Error in expression: ";" expected"

I assume this must be a syntax thing. The memo field I'm using has: [variable_name]. What is the proper way to get my string variable into this field?

Many thanks
Mark

Comments

  • edited 10:35AM
    you should use quotes to pass that variables:

    frxReport1.Variables := QuotedStr(your_string);

    another way is to use frxGlobalVariables - they are static and don't require quotes:

    frxGlobalVariables := your_string;
  • edited 10:35AM
    Ok, I figured this out. I have to put the text in quotes: variable := '''xxxx'''

    Mark
  • edited 10:35AM
    Thanks Alex, you just beat me to it!

    Mark

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.