web stats
JSON Looping question - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-21-2019, 06:57 AM
tdickerson tdickerson is offline
Mirth Newb
 
Join Date: Aug 2016
Posts: 6
tdickerson is on a distinguished road
Default JSON Looping question

Hi - I have a question. I am pulling information from a database and sending out a JSON message.

The template looks like this:
"geneList": [{
"gene": ""
},
{
"gene": ""
},
{
"gene": ""
}
],

My code is this:
var geneListQuery = executeCachedQuery(dbConn, geneQuery);

var geneCount = 0;

while(geneListQuery.next()){

tmp['testDetails']['geneList'][geneCount]['gene'] = geneListQuery.getString('hgnc_symbol');

}
geneCount++;

The result I am getting is this:
"geneList" : [
{
"gene" : "ZRSR2"
},
{
"gene" : ""
},
{
"gene" : ""
}
],

There are approximately 600 genes to be listed, and it is only showing the last one. Can anyone help me on this??
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:51 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation