Thank you.
I'll try to accomplish this and then I'll record it here.
Thank you.
I'll try to accomplish this and then I'll record it here.
Ok.
For example. We have developed a visual platform for our customers. And on this platform, there is a field for the client to complete the period that he wants to see in the report, as in the image below. So what I wanted to know was, if it were possible, when the user clicked the "Gerar Relatório" button, I could trigger the "Run" in jsreport.
Hi guys.
Would I like to know if there is a possibility to run a report through a command on another site?
It worked.
Thank you very much, once again.
Thank you very very much for the help Boris.
Can I ask you one more favor?
Could you help me call this data in the Invoice-template?
I got it.
async function beforeRender(req, res, done) {
var str = "";
https
.get(
"https://app.sm4rt.com.br/feed/timevalue.json?id=40&apikey=f9cae76090f9f4ba97d5920fd003d3d4",
res => {
is resp => {
Thank you, but the error continued.
I thought could be my server but, I tested in the Invoice example of the Playground and also gave a timeout.
Do you have any more idea what could be?
I really do not know how to solve this error.
Hi guys.
Thank you very much for the tips, you are helping a lot.
however, when I use the script, at the time of generating the PDF, this error occurs
Anyone know what it might be?
And how to solve?
I was able to make a request of the data with this code below:
async function beforeRender(req, res){
var str = '';
const https = require('https');
https.get('https://app.sm4rt.com.br/feed/timevalue.json?id=40&apikey=f9cae76090f9f4ba97d5920fd003d3d4',
(result) => {
result.on('data', (b) => {
str += b;
console.log('Data :' + JSON.parse(str).value);
});
});
return {row: str};
}
However, I still do not know how to call this variable in main -Template.
Sorry, I can not extract that value.
I've tried it in many ways.
Please, can you give me another example besides this:
https://jsreport.net/learn/scripts
https://playground.jsreport.net/w/admin/hG7mEoll
https://playground.jsreport.net/w/anon/dqFUCAtZ
https://playground.jsreport.net/w/admin/tW8CsfTt
Hi guys,
I have a url "https://app.sm4rt.com.br/feed/timevalue.json?id=40&apikey=f9cae76090f9f4ba97d5920fd003d3d4", that has a JSON file {"time":"1549978493","value":"137.678"}, then I would like to add this value to a report.
I was trying the function below in a script and in a helper:
function getValue() {
var val;
const https = require('https');
https.get('https://app.sm4rt.com.br/feed/timevalue.json?id=40&apikey=f9cae76090f9f4ba97d5920fd003d3d4', (res) => {
// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
val = data.value;
});
// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log(data.replace(/"/g,""));
});
}).on("error", (err) => {
console.log("Error: " + err.message);
});
return val;
}
But, I could not show the value in the report. How should I call this function in the template?
Could you help me with this question?
Thank you for your attention