namtax
June 15, 2010, 7:23pm
1
Hi there
Am having a few issues and wondering if anyone can assist
I am building a query in an event handler, which grabs data from the
last fm api..
rc.qryTopTracks =
application.lastFm.artist.getTopTracks2(rc.name_art);
I am looping this query in my view to output data. However I want to
test if one of variables from this query is defined or not, but the
coldbox functions dont seem to be allowing me to do so..
<cfoutput query="rc.qryTopTracks">
if(event.valueExists('QRYTOPTRACKS.url')){
DO THIS......
}
</cfoutput>
Can anyone assist?
Many thanks
This should work:
if ( StructKeyExists( rc.qryTopTracks.columnlist, “url” ) )
{
// do something
}
namtax
June 16, 2010, 9:08pm
3
Thanks for your response
Tried it, I get following error message
You have attempted to dereference a scalar variable of type class
java.lang.String as a structure with members.
namtax
June 16, 2010, 9:17pm
4
I have tried the paramvalue in the handler previously, to no avail..
event.paramValue('qrytoptracks.url','_');
I presume
<cfset myVar = event.getValue( 'qrtTopTracks' , '')>
should be
<cfset myVar = event.setValue( 'qryTopTracks' , '')>
?
If so, that doesnt seem to function either
Thanks
Brett1
June 16, 2010, 9:22pm
5
I think John's suggestion should of been this:
if ( listFindNoCase ( rc.qryTopTracks.columnlist, "url" ) )
{
// do something
}
Ah yes, that’s exactly what I meant - thanks Brett and sorry namtax.
namtax
June 19, 2010, 5:14pm
7
Yes, that has worked, thanks very much...i didnt realist there was a
columnlist function, that will come in handy