<cfset views_sold = StructNew()>
<cfloop query="GetCampaigns">
<cfscript>
if (guaranteed NEQ '')
{
views_sold["guaranteed"] = guaranteed;
views_sold["views_left"] = (guaranteed - views);
views_sold["days_left"] = DateDiff("d",start_date,end_date);
views_sold["tomorrows_views"] = round(views_sold.views_left /
views_sold.days_left);
views_sold["rotation_freq"] = round(views_sold.tomorrows_views /
views_sold.days_left);
views_sold["description"] = descrip;
}
</cfscript>
</cfloop>

Robert Everland III
Web Developer
Dixon Ticonderoga


-----Original Message-----
From: Jon Hall [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 15, 2000 12:03 PM
To: CF-Talk
Subject: cfscript & structures


I am working with cfscript and functions, and I cant figure out why this is
happening.

This works:

<cfset views_sold = StructNew()>
<cfloop query="queryName">
<cfset strname = descrip>
<cfif guaranteed NEQ ''>
<cfset rs = SetVariable(strname,StructNew())>
<cfset rs = StructInsert(strname, "guaranteed", guaranteed)>
<cfset rs = StructInsert(strname, "views_left", guaranteed - views)>
<cfset rs = StructInsert(strname, "days_left",
DateDiff("d",start_date,end_date))>
<cfset rs = StructInsert(strname, "tomorrows_views",
round(views_sold.views_left / views_sold.days_left))>
<cfset rs = StructInsert(strname, "rotation_freq",
round(views_sold.tomorrows_views / views_sold.days_left))>
</cfif>
</cfloop>

This doesn't:

<cfset views_sold = StructNew()>
<cfloop query="GetCampaigns">
<cfscript>
if (guaranteed NEQ '')
views_sold["guaranteed"] = guaranteed;
views_sold["views_left"] = (guaranteed - views);
views_sold["days_left"] = DateDiff("d",start_date,end_date);
views_sold["tomorrows_views"] = round(views_sold.views_left /
views_sold.days_left);
views_sold["rotation_freq"] = round(views_sold.tomorrows_views /
views_sold.days_left);
views_sold["description"] = descrip;
</cfscript>
</cfloop>

I know I am using different notations in my examples, but I dont think that
is why, because I tried using the structInsert function in my cfscript and
still got the below error:

Error near line 24, column 11.
Cannot convert to number.
Please, check the ColdFusion manual for the allowed conversions between data
types
Line 24 is views_sold["views_left"] = (guaranteed - views);

Anyone know why this is happening?

jon
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to