Recent

Author Topic: Error in script  (Read 2820 times)

RusDeveloper

  • New Member
  • *
  • Posts: 24
Error in script
« on: July 23, 2016, 11:51:40 am »
There's a script in memo of LazReport:
Code: Pascal  [Select][+][-]
  1. VS1:= VS1 + [sqlMain."S1"];
where

VS1 - a variable that is passed to a report from the code like this:
Code: Pascal  [Select][+][-]
  1. frVariables['VS1'] := 5;
This variable is transmitted without errors and if the register in the memo [VS1], it displays "5".

[sqlMain."S1"] - field of TSQLQuery. Output "6" in the memo without problems, if simply register [sqlMain. "S1"].


But when I run a report for the
Code: Pascal  [Select][+][-]
  1. VS1:= VS1 + [sqlMain."S1"];
I get an error Invalid variant operation on string result := V1 + V2 in code of file lr_pars.pas:
Code: Pascal  [Select][+][-]
  1. function SumOrConcat(const V1,V2: Variant): Variant;
  2. begin
  3.   if VarIsStr(V1) then
  4.     result := V1 + VarToStr(V2)
  5.   else
  6.   if VarIsStr(V2) then
  7.     result := VarToStr(V1) + V2
  8.   else
  9.     result := V1 + V2
  10. end;

If you look at the values V1 and V2 under the debugger, you will get:
V1 = 5
V2 = unsupported variant type: TFMTBCDFactory
How do I fix this?

 

TinyPortal © 2005-2018