<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Input SQL results to report]]></title><description><![CDATA[<p>Hi JS-Team,</p>
<p>Here is the code that i'm struggle with.</p>
<pre><code>GetreportSchedule : function(req, res){
               var query = db.query(&quot;Select * from trainStops&quot;, function (err, result) {
                if (err) {
                    console.log(req.body);
                 } else {
                 var objs = [];
                 for (var i = 0;i &lt; result.length; i++) {
                        objs.push({&quot;id&quot;: result[i].s_Id,&quot;name&quot;:result[i].name,&quot;arr&quot;:result[i].arr,&quot;dept&quot;:result[i].dept});
                  }
            
                   var arrayX = JSON.stringify(objs);
            
                    var data = {
                          template:{&quot;shortid&quot;:'BynN_cl0l'},
                          data:{&quot;trainStops&quot;:arrayX}
                     }
                     var options = {
                           uri:'http://localhost:8001/api/report',
                           method:'POST',
                           json:data
                     }
                     request(options).pipe(res);  
        }
    });
},
</code></pre>
<p>When i replace arrayX with its output, pdf works fine. But when i use arrayX (as above example) i'll get an empty pdf.<br />
Can someone please tell me what I did wrong?</p>
]]></description><link>https://forum.jsreport.net/topic/78/input-sql-results-to-report</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 02:20:05 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/78.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 30 Apr 2017 06:40:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Input SQL results to report on Invalid Date]]></title><description><![CDATA[<p>Hi JS-Team,</p>
<p>Here is the code that i'm struggle with.</p>
<pre><code>GetreportSchedule : function(req, res){
               var query = db.query(&quot;Select * from trainStops&quot;, function (err, result) {
                if (err) {
                    console.log(req.body);
                 } else {
                 var objs = [];
                 for (var i = 0;i &lt; result.length; i++) {
                        objs.push({&quot;id&quot;: result[i].s_Id,&quot;name&quot;:result[i].name,&quot;arr&quot;:result[i].arr,&quot;dept&quot;:result[i].dept});
                  }
            
                   var arrayX = JSON.stringify(objs);
            
                    var data = {
                          template:{&quot;shortid&quot;:'BynN_cl0l'},
                          data:{&quot;trainStops&quot;:arrayX}
                     }
                     var options = {
                           uri:'http://localhost:8001/api/report',
                           method:'POST',
                           json:data
                     }
                     request(options).pipe(res);  
        }
    });
},
</code></pre>
<p>When i replace arrayX with its output, pdf works fine. But when i use arrayX (as above example) i'll get an empty pdf.<br />
Can someone please tell me what I did wrong?</p>
]]></description><link>https://forum.jsreport.net/post/304</link><guid isPermaLink="true">https://forum.jsreport.net/post/304</guid><dc:creator><![CDATA[rahalJayawardane]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Input SQL results to report on Invalid Date]]></title><description><![CDATA[<p>Does this work with html recipe? ... I don't understand why you call <code>JSON.stringify(objs);</code> when all other values are passed as json objects.</p>
]]></description><link>https://forum.jsreport.net/post/310</link><guid isPermaLink="true">https://forum.jsreport.net/post/310</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Input SQL results to report on Invalid Date]]></title><description><![CDATA[<p>Also, you should probably use the <code>json:true, body: data</code> in options <a href="https://github.com/request/request" rel="nofollow">https://github.com/request/request</a></p>
]]></description><link>https://forum.jsreport.net/post/311</link><guid isPermaLink="true">https://forum.jsreport.net/post/311</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Input SQL results to report on Invalid Date]]></title><description><![CDATA[<p>Thanks for the reply sir!</p>
<p>i call JSON.stringify(objs) to create the json object as what i needed according to the report. And Yes! report is working fine in html recipe.<br />
However &quot;json:true, body: data&quot; didn't work out.</p>
<p>for more clarity:</p>
<p>when i wrote below line manually report working perfectly.<br />
data: {&quot;trainStops&quot;:[{&quot;id&quot;:&quot;3007&quot;,&quot;name&quot;:&quot;Colombo Fort&quot;,&quot;arr&quot;:&quot;07:05&quot;,&quot;dept&quot;:&quot;07:06&quot;},{&quot;id&quot;:&quot;3008&quot;,&quot;name&quot;:&quot;Airport&quot;,&quot;arr&quot;:&quot;07:00&quot;,&quot;dept&quot;:&quot;07:01&quot;}] }</p>
<p>console.log(arrayX) gives below output:<br />
[{&quot;id&quot;:&quot;3007&quot;,&quot;name&quot;:&quot;Colombo Fort&quot;,&quot;arr&quot;:&quot;07:05&quot;,&quot;dept&quot;:&quot;07:06&quot;},{&quot;id&quot;:&quot;3008&quot;,&quot;name&quot;:&quot;Airport&quot;,&quot;arr&quot;:&quot;07:00&quot;,&quot;dept&quot;:&quot;07:01&quot;}]</p>
<p>but when i'm using below code report shows as an empty page.<br />
data: {&quot;trainStops&quot;: arrayX }</p>
<p>My English is not so good, sorry for that and hope you understood my problem anyway. :D</p>
]]></description><link>https://forum.jsreport.net/post/312</link><guid isPermaLink="true">https://forum.jsreport.net/post/312</guid><dc:creator><![CDATA[rahalJayawardane]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>