Quotes inside variables

I design a report generating invoices. I want a last page with the name of every client and the amount owed.

So I store names and amounts like this :
set('Name'+<Table."UniqueId">,<Table."Name">)
set('Amount'+<Table."UniqueId">,<Table."Amount">)

I get the data back with
get('Name'+<Table."UniqueId">)

All this works perfectly until one of the clients' name contains a quote. I get the ";" expected error.

I tried with the OnBeforePrint event :
* Memo71.text:=Get('Name'+<frxAD."code">);
* Memo71.text:=''''+Get('Name'+<frxAD."code">)+'''';
* Set(Memo71.Text,Get('Name'+<frxAD."code">));


Wrote an "Escape" function to double the quotes :

Function Escape(s:String):String;
Var i:Integer;
Begin
  Result:='';
  if s<>'' then
    For i:=1 to length(s) do
      if s[i]='''' then
        Result:=Result+''''''
      else
        Result:=Result+s[i];
End;

And used it like :
Memo71.text:=Escape(Get('Name'+<frxAD."code">));

But the function is never called. It seems like the problem is in the GET function.

Did I miss something in the doc ? Is it a restriction or a bug (soon to be corrected) ?

Thx for your patience.

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.