Note that there are some explanatory texts on larger screens.

plurals
  1. POConvert struct to query Coldfusion
    text
    copied!<p>Wondering if anyone can assist</p> <p>I am utilizing some code from <a href="http://www.riaforge.org" rel="nofollow noreferrer">RIAForge</a> which integrates with the Last.fm api...</p> <p>One of the methods outputs as a struct, but I would like to modify the code so it outputs as an array, am unsure of how to do this..</p> <p>Currently the code is like this</p> <pre><code>&lt;cfscript&gt; var args = StructNew(); var returnStruct = StructNew(); var results = ""; var i = 0; args['playlistURL'] = arguments.playlistURL; results = super.callMethod('playlist.fetch', args).playlist; returnStruct['title'] = results[':title']; returnStruct['annotation'] = results[':annotation']; returnStruct['creator'] = results[':creator']; returnStruct['date'] = results[':date']; if(StructKeyExists(results, ':trackList') AND StructKeyExists(results[':trackList'], ':track')){ results = super.ensureArray(results[':trackList'][':track']); returnStruct['tracks'] = QueryNew('album,creator,duration,identifier,image,info,title'); for(i=1; i LTE ArrayLen(results); i=i+1){ QueryAddRow(returnStruct.tracks); QuerySetCell(returnStruct.tracks, 'album', results[i].album); QuerySetCell(returnStruct.tracks, 'creator', results[i].creator); QuerySetCell(returnStruct.tracks, 'duration', results[i].duration); QuerySetCell(returnStruct.tracks, 'identifier', results[i].identifier); QuerySetCell(returnStruct.tracks, 'image', results[i].image); QuerySetCell(returnStruct.tracks, 'info', results[i].info); QuerySetCell(returnStruct.tracks, 'title', results[i].title); } } return returnStruct; </code></pre> <p></p> <p>Am just wondering if there is a coldfusion method that allows me to convert the returnStruct into a query..</p> <p>Many thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload