Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
fu-meng #1
checking for values
hi. i'd like to perform a check on some values. these values are being
populated into a structure that i'm then returning to flash. here's how it's
currently set up: <cfscript> inventory[counter]['visits_total'] =
visits_total; inventory[counter]['time_total'] = time_total;
inventory[counter]['time_view_avg'] = time_view_avg; </cfscript> what i'm
trying to do is check the visits_total. if that equals zero or if it returns
some undefined value, then i'd like to populate it with a value of '0'.
currently, it just returns an empty value. i tried this but it doesn't seem to
be working. <cfscript> <cfif visits_total NEQ ''>
inventory[counter]['visits_total'] = visits_total;
inventory[counter]['time_total'] = time_total;
inventory[counter]['time_view_avg'] = time_view_avg; <cfelse>
inventory[counter]['time_total'] = time_total;
inventory[counter]['visits_total'] = 0;
inventory[counter]['time_view_avg'] = 0; </cfif> </cfscript> now
when i run this, no values are being returned at all. can i put a conditional
within cfscript tags? i'm not really sure where i'm going wrong as i'm
relatively new to coldfusion and my knowledge is a bit scattered on the
subject. any insight is greatly appreciated. best, fumeng.
fu-meng Guest
-
read row values from datagrid and populate in new datagrid values from connected
Hello, i am new in asp.net and i am having a question: I am having a datagrid_1 in which i am showing the context of PatientDetails table.... -
Why don?t the location values in the Sprite Overlay agree with the values
I would expect the left,top,right bottom values for a sprite that appear underneath it on the stage when you click on it to agree with the l,t,r,b... -
checking for values in MySQL and other conditions not working???
I'm trying to redirect when testing for certain condidtions as shown below. When the conditions are ture, it redirects, but still goes ahead and... -
checking for values in a query
I have a form that has a phone number field. Upon trying to leave the field I would like to run a piece of code that would check if the value... -
Adding custom values and database values to DropDwonList
The other way is to create a DataTable, put the --None-- as the first Row, then read the datareader into the DataTable, and append the --other-- at... -
nTesla #2
Re: checking for values
You probably want something like this (remember, <cfscript> is a slightly
different *dialect* than cfml.
<cfscript>
if (visits_total NEQ "") {
inventory[counter]["visits_total"] = visits_total;
inventory[counter]["time_total"] = time_total;
inventory[counter]["time_view_avg"] = time_view_avg;
} else {
inventory[counter]["time_total"] = time_total;
inventory[counter]["visits_total"] = 0;
inventory[counter]["time_view_avg"] = 0;
}
</cfscript>
<!--- OR --->
<cfif (visits_total NEQ "")>
<cfset inventory[counter]["visits_total"] = visits_total>
<cfset inventory[counter]["time_total"] = time_total>
<cfset inventory[counter]["time_view_avg"] = time_view_avg>
<cfelse>
<cfset inventory[counter]["time_total"] = time_total>
<cfset inventory[counter]["visits_total"] = 0>
<cfset inventory[counter]["time_view_avg"] = 0>
</cfif>
nTesla Guest
-
fu-meng #3
Re: checking for values
hello. thank you very much for responding to my post. i appreciate your help.
i knew cfscript had a different syntax, ironically, it is one that i'm more
used to coding in....and i still had to ask! but i got it now and understand
why it works. so, thanks for your help. much appreciated -- fumeng.
fu-meng Guest



Reply With Quote

