Why report generation API not working in standalone application and web application?

5 views (last 30 days)
I have created UI using App Designer for report generation. In MATLAB application it is running fine but, in standalone and web it is showing error
The error I got for web app is
2021-12-07 16:05:54 New session requested for "sampleappcopy"
2021-12-07 16:05:56 Session for "sampleappcopy" created successfully
2021-12-07 16:06:04 Unable to check out a Report Generator license. Reason:
2021-12-07 16:06:04 Error in mlreportgen.report.internal.Document/open
2021-12-07 16:06:04 Error in mlreportgen.report.ReportBase/openImpl
2021-12-07 16:06:04 Error in mlreportgen.report.ReportBase/open
2021-12-07 16:06:04 Error in sampleappcopy/matrixButtonPushed (line 26)
2021-12-07 16:06:04 Error in appdesigner.internal.service.AppManagementService/tryCallback (line 368)
2021-12-07 16:06:04 Error in matlab.apps.AppBase>@(source,event)tryCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 37)
2021-12-07 16:06:04 Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 386)
2021-12-07 16:06:04 Error while evaluating Button PrivateButtonPushedFcn.

Answers (1)

Krishna
Krishna on 23 Aug 2022
I understand that you are working on App Designer for Report Generation and you are facing difficulties while working on web/standalone application.
To resolve this issue, you must first call the following function before you perform any DOM-related code.
makeDOMCompilable()
This function allows you to share your report generation program with others who do not have MATLAB installed on their systems. This worked well to put this in the start-up function ('startupFcn'), so that it is run as soon as the application is launched.
Next, in order to download a document on the Web App Server, you must use the function:
web(d.OutputPath);
Therefore, to ensure correct behavior whether the application is deployed or not, you must use the variable 'isdeployed' in the following if statement:
% code that comes after close(d); %
if isdeployed
web(d.OutputPath);
else
rptview(d.OutputPath); % for .pdf documents, this will be rptview(d);
end
This way, you will not have multiple extraneous windows showing up, rather you will only be shown what is needed given your running environment.
I hope this solves your issue.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!