Wow, thank you. You just help me make my code much easier. I also have learned from it and can now make some cleanup changes to other pages as well. :-) The color is not numeric so I had to add the ' ' around the field, but other then that it worked right off. :-) No need to make a large series of if's.
I would like to ask one question though. In the isnull.cfm script, in the return evaluate(myvar); line what exactly does the evaluate() function do in this case?
Thanks for you help, I always learn so much from this list.
Thanks,
Kevin
----- Original Message -----
You are making this way to hard on yourself. Try something like this to clean up your code and give yourself easier debugging. Also, make sure all of your fields are numeric, or add quotes around inserted values as necessary. The "color" field, for instance, is that numeric or text?
<!--- isnull.cfm --->
<cfscript>
function isNull(myvar){
if(isdefined(myvar))
return evaluate(myvar);
else
return "NULL";
}
</cfscript>
<!--- end isnull.cfm --->
<!--- insert.cfm --->
<cfinclude template="isnull.cfm">
<cfquery name="addLine" datasource="absappa_costmod">
INSERT INTO tblOEOrderDetails
(orderID, styleNumber, sizeScaleID, color, unitPrice, lineTotal
,size1qty,size2qty,size3qty,size4qty,size5qty,size6qty)
VALUES (
#FORM.orderID#, #FORM.styleNumber#, #FORM.sizeScaleID#, #FORM.color#, #FORM.unitPrice#, #FORM.lineTotal#
,#isNull("form.size1qty")#
,#isNull("form.size2qty")#
,#isNull("form.size3qty")#
,#isNull("form.size4qty")#
,#isNull("form.size5qty")#
,#isNull("form.size6qty")#
)
</cfquery>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

