I have a dilemma, any help is deeply appreciated. I've been driving myself nuts trying
to figure out why this doesn't work.
The variable restList comes from an XML file I'm parsing and contains 3 comma
delimited numbers:
<reportID>111,112,207</reportID> (or any infinite variation of numbers in comma
delimited format)
I do the following to pull the list from the XML line:
<cfscript>
repIDStart = #Find("<reportID>", content, 1)#;
repIDEnd = #Find("</reportID>", content, repIDStart)#+11;
repIDTotal = (repIDEnd)-(repIDStart);
restList = #Mid(content, repIDStart, repIDTotal)#;
</cfscript>
I run the following loop to take each list item, convert it to a number and pass it to
a custom tag for processing in an SQL statement that then outputs the report
associated with that number.
<cfloop index="listitem" list="#restList#" delimiters=",">
<cf_outputResults dID="#val(trim(listitem))#">
</cfloop>
If I output the value of #val(trim(listitem))# in the loop, the first one is always 0
the second is 112 and the third is 207 (or whatever numbers are in the list ...
problem is, first is always 0)
If I run IsNumeric(val(trim(listitem))) the first is NO, the second YES and the last
is NO, but the last one still evaluates to the correct number (207,etc.)
If I put a comma in FRONT of the list, they all display correctly.
If there's just one number, it evaluates to 0
Am I going insane or what is it I'm missing? Is there another way to turn a string
value into a number?
Joshua Miller
Eagle Technologies Group, Inc.
www.eagletgi.com
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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