Hi,
I'm trying to insert a value which is computed
using python into a table. The python script looks as follows: -
import string
return((string.atof(QuantityA) *
string.atof(WeightA)) +
(string.atof(QuantityB) * string.atof(WeightB)) +
(string.atof(QuantityC) * string.atof(WeightC)) +
(string.atof(QuantityD) * string.atof(WeightD)))
The sql query to insert this value into the table
is as shown below: -
[Arguments : QuantityA, QuantityB, QuantityC,
QuantityD]
insert
into table
(Net_Weight)
VALUES (<dtml-in
sqlGetSackWeight><dtml-var expr="pyCalculateSackWeight(QuantityA, WeightA,
QuantityB, WeightB, QuantityC, WeightC, QuantityD,
WeightD)"></dtml-in>)
The sqlGetSackWeight is another sql query to
retrieve the value of WeightA, WeightB, WeightC and WeightD which is stored
in a separate table. These values would be multiplied by the value of the
arguments and the total is computed.
The problem is, when I test the sql query to do an
insert, I get an error as shown below
Error Value: Missing objects do not
support conversion to float.
(Info: ({'script': <PythonScript instance at
08C40F00>, 'context': <r instance at 08EE1D40>, 'container': <Folder
instance at 08DD16D0>, 'traverse_subpath': []}, ('1', Missing.Value, '2', 10,
'3', Missing.Value, '4', Missing.Value), {}, None))
File Script
(Python), line 5, in pyCalculateSackWeight
File
E:\Zope2.4.1-NEW\bin\lib\string.py, line 199, in atof
TypeError: (see
above)
Why is it that the value for WeightA, WeightC and WeightD seems to be a
missing whereas, the value for WeightB (i.e 10) is inserted?
I hope you could help me solve this problem as soon
as possible.
Thank you,
Theeba