Forums
This topic is locked
if field = empty question
Posted 03 Feb 2004 15:49:25
1
has voted
03 Feb 2004 15:49:25 sander kerstens posted:
hi there i have a script which should check if a field is empty if yes the str = 0 if not
then a calculation must take place...
this is the script:
<%
Dim strfoto2
if (orders.Fields.Item("fotonaamthumb2".Value) = "" then
strfoto2 = 0
Elseif (orders.Fields.Item("aantal".Value) = 1 then
strfoto2 = (foto2k.Fields.Item("kosten".Value) * (orders.Fields.Item("aantal2".Value)
ElseIf (orders.Fields.Item("aantal2".Value) = 0 then
strfoto2 = 0
ElseIf (orders.Fields.Item("aantal2".Value) Mod 2 = 1 then
strfoto2 = ((foto2k.Fields.Item("kosten".Value) + 0.25) * (orders.Fields.Item("aantal2".Value) + 0.10
else
strfoto2 = ((foto2k.Fields.Item("kosten".Value) + 0.25) * (orders.Fields.Item("aantal2".Value)
end if
%>
the fotonaamthumb2 needs to be checked if empty then calculation
but there seems to be something
wrong because even if the field is
empty the calculation still gives a
number or executes....
thank for your help
greetzzzzz Sander
Replies
Replied 05 Feb 2004 18:57:02
05 Feb 2004 18:57:02 Erik Piisila replied:
It may be that your values when defining in strings or even in your database are not numerical values. str is usually text. Try using sng instead of str