set Text to a variable
Hello,
I am having difficulty setting the value of a variable to a string that has a single quotation mark in it. I see that this is how you have to set a variable value to a string:
Set('Variable', '''' + 'hat'+ '''');
Is this the only way? How would you set the variable to a sting containing a single quote? This doesn't work:
Set('Variable', '''' + 'Sally's Hat'+ '''');
Thank you!
Bridget
I am having difficulty setting the value of a variable to a string that has a single quotation mark in it. I see that this is how you have to set a variable value to a string:
Set('Variable', '''' + 'hat'+ '''');
Is this the only way? How would you set the variable to a sting containing a single quote? This doesn't work:
Set('Variable', '''' + 'Sally's Hat'+ '''');
Thank you!
Bridget
Comments
You can use following script: See a demo in attachment.
Thank you for you help. But going further, how would this be done if <qry."NAME"> sometimes contains a single quote. This is what I had and it doesn't work.
Set('@Name', Copy(<qry."NAME">,1,50));
I even tried this:
tText := ''''+Copy(<qry."NAME">,1,50)+'''';
Set('@Name', tText);
If it isn't obvious, I'm new to Fast Reports programming and am unsure of the syntax sometimes. Thank you!
Thank you for you help. But going further, how would this be done if <qry."NAME"> sometimes contains a single quote. This is what I had and it doesn't work.
Set('@Name', Copy(<qry."NAME">,1,50));
I even tried this:
tText := ''''+Copy(<qry."NAME">,1,50)+'''';
Set('@Name', tText);
If it isn't obvious, I'm new to Fast Reports programming and am unsure of the syntax sometimes. Thank you!
Use following code:
Now I want to set @Name to that input variable but this doesn't work:
Set('@Name', '<VarIn>');