Errors in the async merged report
-
- Posts: 45
- Joined: Wed Sep 04, 2019 5:19 pm
- Location: Curitiba/PR (Brazil)
Errors in the async merged report
Hi,
I'm trying some problems when I merged three reports.
Attachment Screenshot_1:
The times when the report finishes loading it displays the error "cannot read property 'pageNumbers' of null"
Attachment Screenshot_2 and Screenshot_3:
When I go to the third or fourth page of the report, the following errors appear: "Cannot read property 'name' of undefined" and Cannot read property 'sortingEnabled' of undefined
I think it has something to do with the merged report loading the pages of the other reports asynchronously.
Thank you for attention
I'm trying some problems when I merged three reports.
Attachment Screenshot_1:
The times when the report finishes loading it displays the error "cannot read property 'pageNumbers' of null"
Attachment Screenshot_2 and Screenshot_3:
When I go to the third or fourth page of the report, the following errors appear: "Cannot read property 'name' of undefined" and Cannot read property 'sortingEnabled' of undefined
I think it has something to do with the merged report loading the pages of the other reports asynchronously.
Thank you for attention
- Attachments
-
- Cannot read property 'sortingEnabled' of undefined
- Screenshot_3.png (92.28 KiB) Viewed 3356 times
-
- Cannot read property 'name' of undefined
- Screenshot_2.png (61.84 KiB) Viewed 3356 times
-
- cannot read property 'pageNumbers' of null
- Screenshot_1.png (39.49 KiB) Viewed 3356 times
Mateus Garrido Kern
Email: mateus.kern@digibyte.com.br
Email: mateus.kern@digibyte.com.br
-
- Posts: 6256
- Joined: Tue Mar 20, 2018 5:34 am
Re: Errors in the async merged report
Hello,
Please send us a sample project that reproduces the issue for analysis.
Thank you.
Please send us a sample project that reproduces the issue for analysis.
Thank you.
-
- Posts: 45
- Joined: Wed Sep 04, 2019 5:19 pm
- Location: Curitiba/PR (Brazil)
Re: Errors in the async merged report
Hi Lech,
I sent an email to support@stimulsoft with the project with errors and it's generated the number request 3165067.
Thank you
I sent an email to support@stimulsoft with the project with errors and it's generated the number request 3165067.
Thank you
Mateus Garrido Kern
Email: mateus.kern@digibyte.com.br
Email: mateus.kern@digibyte.com.br
-
- Posts: 6256
- Joined: Tue Mar 20, 2018 5:34 am
Re: Errors in the async merged report
Hello,
Thank you. We will let you know about the result.
Thank you. We will let you know about the result.
-
- Posts: 45
- Joined: Wed Sep 04, 2019 5:19 pm
- Location: Curitiba/PR (Brazil)
Re: Errors in the async merged report
Hello, any solution to this problem?
Mateus Garrido Kern
Email: mateus.kern@digibyte.com.br
Email: mateus.kern@digibyte.com.br
-
- Posts: 6256
- Joined: Tue Mar 20, 2018 5:34 am
Re: Errors in the async merged report
Hello,
We are working on the problem, we will let you know about the result.
Thank you.
We are working on the problem, we will let you know about the result.
Thank you.
-
- Posts: 45
- Joined: Wed Sep 04, 2019 5:19 pm
- Location: Curitiba/PR (Brazil)
Re: Errors in the async merged report
Hello,
I received a response from Aleksey Andreyanov by email, written:
"When you render the reports you are using async methods but don't wait for the end of the rendering.
There are no rendered pages when you pass the report to the Viewer.
You should get the report inside the response function. "
What is the Report's response function?
I received a response from Aleksey Andreyanov by email, written:
"When you render the reports you are using async methods but don't wait for the end of the rendering.
There are no rendered pages when you pass the report to the Viewer.
You should get the report inside the response function. "
What is the Report's response function?
Mateus Garrido Kern
Email: mateus.kern@digibyte.com.br
Email: mateus.kern@digibyte.com.br
-
- Posts: 45
- Joined: Wed Sep 04, 2019 5:19 pm
- Location: Curitiba/PR (Brazil)
Re: Errors in the async merged report
Hello,
The answer I received is attached: "Screenshot_1.png".
It is about 3165067 request, and was answered on the August 04, 2020.
What is the Report's response function?
Thank you.
The answer I received is attached: "Screenshot_1.png".
It is about 3165067 request, and was answered on the August 04, 2020.
What is the Report's response function?
Thank you.
- Attachments
-
- Screenshot_1.png (20.79 KiB) Viewed 3087 times
Mateus Garrido Kern
Email: mateus.kern@digibyte.com.br
Email: mateus.kern@digibyte.com.br
Re: Errors in the async merged report
Hello,
You call the renderAsync() function and try to do something with the report right after calling it.
You should do it like in this sample :
Thank you.
You call the renderAsync() function and try to do something with the report right after calling it.
You should do it like in this sample :
Code: Select all
report.renderAsync(function () {
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
var service = new Stimulsoft.Report.Export.StiPdfExportService();
var stream = new Stimulsoft.System.IO.MemoryStream();
for (var index = 1; index <= report.renderedPages.count; ++index) {
settings.pageRange = new Stimulsoft.Report.StiPagesRange(Stimulsoft.Report.StiRangeType.Pages, index.toString());
service.exportTo(report, stream, settings);
var data = stream.toArray();
var fileName = index;
Object.saveAs(data, fileName + ".pdf", "application/pdf");
}
});
-
- Posts: 45
- Joined: Wed Sep 04, 2019 5:19 pm
- Location: Curitiba/PR (Brazil)
Re: Errors in the async merged report
Hello,
I already use the renderAsync method, but I also use the merge between reports, where I intend to merge it only when the user wishes, follow the code:
And keep showing me the same mistake! Any solution for this case?
I already use the renderAsync method, but I also use the merge between reports, where I intend to merge it only when the user wishes, follow the code:
Code: Select all
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { environment } from '../../../../../environments/environment';
declare var Stimulsoft: any;
@Component({
selector: 'app-report-cash-desk-book',
template: `<div id="viewerContent"></div>`
})
export class ReportCashDeskBookComponent implements OnInit {
options: any = new Stimulsoft.Viewer.StiViewerOptions();
viewer: any = new Stimulsoft.Viewer.StiViewer(this.options, 'StiViewer', false);
baseUrl: string;
companyId: string;
dateStart: string;
dateFinish: string;
separateByMonth: string;
cashDeskAccount: string;
bookNumber: string;
dateEmission: string;
dateCloseFiscalYear: string;
showOpenCloseTerms: boolean;
constructor(private activatedRoute: ActivatedRoute) { }
ngOnInit() {
this.baseUrl = environment.apiUrl;
this.activatedRoute.queryParams.subscribe(params => {
this.companyId = params['companyId'];
this.dateStart = params['dateStart'];
this.dateFinish = params['dateFinish'];
this.separateByMonth = params['separateByMonth'];
this.cashDeskAccount = params['cashDeskAccount'];
this.bookNumber = params['bookNumber'];
this.dateEmission = params['dateEmission'];
this.dateCloseFiscalYear = params['dateCloseFiscalYear'];
this.showOpenCloseTerms = params['showOpenCloseTerms'] === 'true' ? true : false;
});
let reportOpen;
let reportCashDeskBook;
let reportClose;
let dbOpen;
let dbCashDeskBook;
let dbClose;
reportCashDeskBook = Stimulsoft.Report.StiReport.createNewReport();
reportCashDeskBook.loadFile('../../../../../assets/reports/reportCashDeskBook.mrt');
reportCashDeskBook.isAsync = true;
dbCashDeskBook = reportCashDeskBook.dictionary.databases.getByName('CashDeskBook');
dbCashDeskBook.pathData = environment.apiUrl + '/v1/reports/cash-desk-book?' +
'companyId=' + this.companyId + '&dateStart=' + this.dateStart + '&dateFinish=' +
this.dateFinish + '&separateByMonth=' + this.separateByMonth;
if (this.cashDeskAccount !== null && this.cashDeskAccount !== undefined) {
dbCashDeskBook.pathData += '&cashDeskAccount=' + this.cashDeskAccount;
}
const reportMerge = new Stimulsoft.Report.StiReport();
reportMerge.reportUnit = reportCashDeskBook.reportUnit;
reportMerge.renderAsync();
reportMerge.renderedPages.clear();
if (this.showOpenCloseTerms) {
reportOpen = Stimulsoft.Report.StiReport.createNewReport();
reportOpen.loadFile('../../../../../assets/reports/ReportOpenCloseTerm.mrt');
dbOpen = reportOpen.dictionary.databases.getByName('JSON');
dbOpen.pathData = this.baseUrl + 'v1/reports/open-cash-desk-book-term?companyId=' +
this.companyId + '&dateStart=' + this.dateStart + '&dateFinish=' + this.dateFinish +
'&separateByMonth=' + this.separateByMonth + '&bookNumber=' + this.bookNumber + '&dateEmission=' +
this.dateEmission + '&dateCloseFiscalYear=' + this.dateCloseFiscalYear;
reportClose = Stimulsoft.Report.StiReport.createNewReport();
reportClose.loadFile('../../../../../assets/reports/ReportOpenCloseTerm.mrt');
dbClose = reportClose.dictionary.databases.getByName('JSON');
dbClose.pathData = this.baseUrl + 'v1/reports/close-cash-desk-book-term?companyId=' +
this.companyId + '&dateStart=' + this.dateStart + '&dateFinish=' + this.dateFinish +
'&separateByMonth=' + this.separateByMonth + '&bookNumber=' + this.bookNumber + '&dateEmission=' +
this.dateEmission + '&dateCloseFiscalYear=' + this.dateCloseFiscalYear;
reportOpen.onBeginProcessData = function (event) {
event.headers.push({key: 'Authorization', value: 'Bearer ' + localStorage.getItem('token')});
};
reportOpen.renderAsync(function () {
for (let index = 0; index < reportOpen.renderedPages.count; ++index) {
reportMerge.renderedPages.add(reportOpen.renderedPages.getByIndex(index));
}
});
}
reportCashDeskBook.onBeginProcessData = function (event) {
event.headers.push({key: 'Authorization', value: 'Bearer ' + localStorage.getItem('token')});
};
reportCashDeskBook.renderAsync(function () {
for (let index = 0; index < reportCashDeskBook.renderedPages.count; ++index) {
reportMerge.renderedPages.add(reportCashDeskBook.renderedPages.getByIndex(index));
}
});
if (this.showOpenCloseTerms) {
reportClose.onBeginProcessData = function (event) {
event.headers.push({key: 'Authorization', value: 'Bearer ' + localStorage.getItem('token')});
};
reportClose.renderAsync(function () {
for (let index = 0; index < reportClose.renderedPages.count; ++index) {
reportMerge.renderedPages.add(reportClose.renderedPages.getByIndex(index));
}
});
}
reportMerge.renderedPages.list.forEach(function(page, i, arr) {
const pagination = page.components.getByName('Pagination');
if (pagination) {
pagination.text = 'Page ' + (i + 1) + ' of ' + reportMerge.renderedPages.count;
}
const centralText = page.components.getByName('CentralText');
if (centralText) {
centralText.text = centralText.text.replace(/{TotalPages}/gi, '' + reportMerge.renderedPages.count);
}
});
this.options.appearance.fullScreenMode = true;
this.options.toolbar.displayMode = Stimulsoft.Viewer.StiToolbarDisplayMode.Separated;
this.viewer.report = reportMerge;
this.viewer.renderHtml("viewerContent");
}
}
Mateus Garrido Kern
Email: mateus.kern@digibyte.com.br
Email: mateus.kern@digibyte.com.br