Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Convert struct to query

New Here ,
Feb 27, 2010 Feb 27, 2010

Hi there

Wondering if anyone can assist

I am utilizing some code from ria.forge which integrates with the last.fm api...

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..

Currently the code is like this

<cfscript>

     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.album);

     QuerySetCell(returnStruct.tracks, 'creator', results.creator);

     QuerySetCell(returnStruct.tracks, 'duration', results.duration);

     QuerySetCell(returnStruct.tracks, 'identifier', results.identifier);

     QuerySetCell(returnStruct.tracks, 'image', results.image);

     QuerySetCell(returnStruct.tracks, 'info', results.info);

     QuerySetCell(returnStruct.tracks, 'title', results.title);

     }

}

     return returnStruct;

</cfscript>

Am just wondering if there is a coldfusion method that allows me to convert the returnStruct into a query..

Many thanks

1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 28, 2010 Feb 28, 2010
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 28, 2010 Feb 28, 2010
LATEST

Hi

Iv looked at this before, isnt this more converting a query to a struct?

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources