Avatar of MichaelEvangelista
MichaelEvangelista
 asked on

QuerySetCell changes numeric value

I have a query that is a Q of Q from a cfdirectory, getting a list of image files

<!--- Query the Query --->
<cfquery name="application.listimages" dbtype="query">
SELECT NAME, DATELASTMODIFIED, SIZE as filesize
FROM application.imagedir
ORDER by NAME
</cfquery>

Works fine.

What I want to do, before I output my xml for the gallery i am using, is to format the filesize value in the query.

Using 'querySetCell()' , I am having results I cannot explain.

<cfloop query="application.listImages">
<cfset sizevaltemp = querySetCell(application.listImages, 'filesize', '#numberFormat(filesize, ',')#', #rowID#)>
</cfloop>

If I do a cfdump for "numberformat(filesize, ',')", I get the correct, formatted number.
But if I dump out the query after this point, the number inserted is a different, negative value.

Is there something strange about querysetcell() and numeric values?
How can I replace the value of this existing query object row by row in my cfloop?






ColdFusion Language

Avatar of undefined
Last Comment
MichaelEvangelista

8/22/2022 - Mon
rob_lorentz

what about doing the formatting as part of the sql select?

SELECT NAME, DATELASTMODIFIED, SIZE as filesize,
    substring(convert(varchar(40), cast(size as money), 1), 0, len(convert(varchar(40), cast(sizeas money), 1))-2) as displayFileSize
FROM application.imagedir
ORDER by NAME
ASKER CERTIFIED SOLUTION
Zvonko

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MichaelEvangelista

ASKER
@Zvonko: Perfect, thank you. Adding the '' blank field to the query, then copying from one column to the other, is perfect.
MichaelEvangelista

ASKER
@rob: looks slick, but didn't try it.  Maybe it will help somebody else, thanks for posting.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy