Exception: "Could not convert type (String) into type (Double)
Hi,
here is the problem : I'm loading a report template, I'm trying to
print-preview it using ppReport.DeviceType := dtScreen and ppReport.Print;
But, an exception occurs:
"Can't execute program : Forcustdiscount1OnCalc
Could not convert variant of type (String) into type (Double)"
Here is the code in my Forcustdiscount1.OnCalc :
===================================================
if Report.DataPipeLine['CUSTOMER.DISCOUNT'] <> 0 then
begin
if Report.DataPipeLine['CUSTOMER.DISC_TYPE'] = '1' then
begin
Value := Report.DataPipeLine['CUSTOMER.DISCOUNT'] + ' %'
end
else
begin
Value := ''
end;
end
else
begin
Value := ''
end;
===================================================
In the Report.DataPipeLine Fields, EVERY field's datatype is dtString. What
may cause this error?
David Caouette
Developer
Omniciel International inc.
P.S : By the way, I developed a Crystal Reports to Report Builder converter.
The resulting .RTM file only needs database settings and few layout
adjustements. Only TeeChart and CrossTabs are the last items to be
implemented.
here is the problem : I'm loading a report template, I'm trying to
print-preview it using ppReport.DeviceType := dtScreen and ppReport.Print;
But, an exception occurs:
"Can't execute program : Forcustdiscount1OnCalc
Could not convert variant of type (String) into type (Double)"
Here is the code in my Forcustdiscount1.OnCalc :
===================================================
if Report.DataPipeLine['CUSTOMER.DISCOUNT'] <> 0 then
begin
if Report.DataPipeLine['CUSTOMER.DISC_TYPE'] = '1' then
begin
Value := Report.DataPipeLine['CUSTOMER.DISCOUNT'] + ' %'
end
else
begin
Value := ''
end;
end
else
begin
Value := ''
end;
===================================================
In the Report.DataPipeLine Fields, EVERY field's datatype is dtString. What
may cause this error?
David Caouette
Developer
Omniciel International inc.
P.S : By the way, I developed a Crystal Reports to Report Builder converter.
The resulting .RTM file only needs database settings and few layout
adjustements. Only TeeChart and CrossTabs are the last items to be
implemented.
This discussion has been closed.
Comments
You need to set the DataType property of the TppVariable to the type of data
you are trying to set it as. Are you certain CUSTOMER.DISCOUNT is a string
type? You also may need to convert this value to a string.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com