HI bjimatos am trying same process on another machine the download reports in excel and pdf format for jsreport studio. Here the recipe is having in jsreport studio "html-with-browser-client" if i changed to "html" i got the error for jsreport is not defined. As you told for this fix to change recipe. i tried in another machine that the reports are not download in jsreport studio it throws undefined error how to fix this problem.
saranilangoRasu
@saranilangoRasu
Posts made by saranilangoRasu
-
RE: ReferenceError: jsreport is not defined
-
RE: how to show the ajax response(reports) in Excel format each object in each cell
Am using third party API to get my reports in jsreport studio script section.
the code is :var http = require('http');
function beforeRender(req, res, done) {
require('request')({
url:"your_API",
json:true
}, function(err, response, body){
req.data.posts = body;
done();
});
} -
jsreport methods got undefined on angular application.
I have used the reports in jsreport studio from my application, In this report i download pdf and excel format jsreport studio, this template i used in my application while download pdf and excel format the methods got undefined.
The jsreport studio code is:
<button onclick="printExcel()" style="width: 200px" class="small-button button loading-pulse lighten success">
Download Excel Report
</button>
<button onclick="printPdf()" style="width: 200px" class="small-button button loading-pulse lighten primary">
Download pdf Report
</button>the script code is:
function printExcel() {
var blob = new Blob([document.getElementById('testform').innerHTML], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;"
});
saveAs(blob, "Report.xls");
}
function printPdf() {
var myJSON = JSON.stringify(jsreport.data.posts);
var blob = new Blob([myJSON], {
type: "application/pdf"
});
var pdf = new jsPDF();
pdf.addHTML(($("#pdfContent")[0]), { pagesplit: true }, function () {
pdf.save('NovusReport' + '.pdf');
});
}In this code have two methods got undefined while using my application via API.
![alt text]( image url)
here all the jsreport script method is comes in my application but i don't know why it got undefined .
-
RE: how to show the ajax response(reports) in Excel format each object in each cell
the jsreport.data having the following data
{
"Facility": "PD Prototype Medical Center (Bridge)",
"Report_Type": "Discharge Medication Instructions",
"Time": "Jul 12, 2017 02:12AM",
"Name": "A,Yogesh Kannan,III",
"MRN": "4285",
"VN": "2643",
"DOB": "06/05/1993",
"Age": "24 years",
"Ht": "",
"Gender": "Male",
"Wt": "",
"BSA": "",
"Medication": "",
"FOod": " BSR",
"Sub": "",
"Latex": "",
"Discharge_Meds": [{
"Name": "Diflucan (Fluconazole)",
"Direction": "100 mg tab by mouth Wednesday, 7 December 2016",
"Next_Dose": "",
"Reason": "",
"Product": "Diflucan Oral Tablet 100 MG",
"Reason_Not_Continued": "",
"Comment": "",
"Quantity": "",
"Refills": "0",
"Status": "(Stop)"
},
{
"Name": "Aspirin",
"Direction": "",
"Next_Dose": "",
"Reason": "",
"Product": "Aspirin Powder",
"Reason_Not_Continued": "",
"Comment": "",
"Quantity": "1 capsule",
"Refills": "0",
"Status": "(Changed)"
},
{
"Name": "Aspirin",
"Direction": "1 mg by mouth three (3) times per day",
"Next_Dose": "",
"Reason": "",
"Product": "Aspirin Oral Tablet 325 MG",
"Reason_Not_Continued": "",
"Comment": "",
"Quantity": "0",
"Refills": "0",
"Status": "(Changed)"
},
{
"Name": "Ibuprofen",
"Direction": "200 mg by mouth three (3) times per day as needed",
"Next_Dose": "",
"Reason": "",
"Product": "",
"Reason_Not_Continued": "",
"Comment": "",
"Quantity": "0",
"Refills": "0",
"Status": "(Continued)"
},
{
"Name": "Glimepiride",
"Direction": "4 mg by mouth daily",
"Next_Dose": "",
"Reason": "",
"Product": "",
"Reason_Not_Continued": "",
"Comment": "",
"Quantity": "0",
"Refills": "0",
"Status": "(New)"
},
{
"Name": "Rx: Compazine (PO/IV/IM/PR) (Prochlorperazine (PO/IM/IV/PR))",
"Direction": "strength/unit ___ two (2) times per day",
"Next_Dose": "",
"Reason": "",
"Product": "",
"Reason_Not_Continued": "",
"Comment": "",
"Quantity": "0",
"Refills": "0",
"Status": "(New)"
}]
} -
how to show the ajax response(reports) in Excel format each object in each cell
Here i have working on download the reports in Excel and pdf format, i need to display the each object in each cell in excel.
code is :
<button onclick="printExcel()" style="width: 200px" class="small-button button loading-pulse lighten success">
Download Excel Report
</button><script>
function printExcel() {
console.log("jsreport.data--->",jsreport.data.posts);
var myJSON = JSON.stringify(jsreport.data.posts);
console.log("jsreport.myJSON-->",myJSON)
var blob = new Blob([myJSON], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;"
});
saveAs(blob, "Report.xls");
}
</script> -
RE: ReferenceError: jsreport is not defined
Hi bjrmatos, am getting same error after the recipe is changed to html, the error is "Uncaught ReferenceError: jsreport is not defined: @ http://localhost:9000/novus#!/visit/VWJ3S3Q0VEFPWVlxTk9wcHJkWmpOZy0t/meds/1/medlist:37" can you help?
-
RE: ReferenceError: jsreport is not defined
here the interactive report 1 is the report was download pdf and excel format, in script shortid is "SJ7JVjh4W"
-
RE: ReferenceError: jsreport is not defined
i used only API on my nodejs application. the pdf or excel was download fine in jsreport studio, in will not come on node.js application.
for your reference my script code is :
self.getJsReport = function (report) { var req; switch (report) { case 'report1': req = { method: 'POST', url: 'http://localhost:4000/api/report', "async": true, "crossDomain": true, "headers": { "content-type": "application/json", "cache-control": "no-cache" }, "processData": false, "data": "{\"template\":{\"shortid\":\"H1RO-jhVb\"},\"data\":{\"aProperty\":\"value\"}}" } break; case 'report2': req = { method: 'POST', url: 'http://localhost:4000/api/report', "async": true, "crossDomain": true, "headers": { "content-type": "application/json", "cache-control": "no-cache" }, "processData": false, "data": "{\"template\":{\"shortid\":\"Hyoh-s3NW\"},\"data\":{\"aProperty\":\"value\"}}" } break; case 'report3': req = { "async": true, "crossDomain": true, "url": "http://localhost:4000/api/report", "method": "POST", "headers": { "content-type": "application/json", "cache-control": "no-cache" }, "processData": false, "data": "{\"template\":{\"shortid\":\"SJ7JVjh4W\"},\"data\":{\"aProperty\":\"value\"}}" } break; } $http(req).then(function(data){ self.writetodiv(data.data,report); }, function(){ });
The html code is:
</uib-accordion-group> <li><a data-ng-click="e.getJsReport('report1')">Report 1</a></li> <li><a data-ng-click="e.getJsReport('report2')">Report 2</a></li> <li><a data-ng-click="e.getJsReport('report3')">Interactive Report 1</a></li> </uib-accordion>
-
RE: ReferenceError: jsreport is not defined
yes thank you, but report not download the pdf or Excel format i got the following error "An error has accrued Script error.: @ :0" how could i fix this problem?