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 :
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.
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.