Inherit a Report Template or create a base report in ActiveReportJS (React)

Posted by: cibarra on 5 September 2024, 4:43 pm EST

    • Post Options:
    • Link

    Posted 5 September 2024, 4:43 pm EST

    Hi,

    I saw this post https://developer.mescius.com/activereportsnet/docs/latest/online/inherit-report-template.html and I was wondering if this feature is enabled for the Designer component in the ActiveReportsJS package for React?

    So far I am exploring and trying to understand the difference between case implementations of the different report types (CPL - Continuous Page Layout, FPL - Fixed Page Layout, Pageless - Pageless Report Layout) and trying to see if this is the same behavior that the previous mentioned post is referring but I got stuck on the implementation of the onOpenFileMenu. Does the onOpenFileMenu have a default behavior or UI or do I have to implement both custom in order to make available the option to choose the report type during the creation of a new report?

    Hope you guys can help me to understand these topics.

    Regards!

  • Posted 6 September 2024, 4:42 am EST

    Hi Cesar,

    The link you are referencing is for our other product ActiveReports.NET which has a Code-Based report type called SectionReport that is created using .NET classes and thus has the ability to inherit other reports.

    Unfortunately, the ability to inherit in the fashion mentioned in the link is not exactly possible in ActiveReportsJS. However, ActiveReportsJS does have the ability to use Report Parts i.e. you can reuse a component from another report in your report.

    You can learn more about Report Parts here: Report Parts Introduction, Using Report Parts and Report Parts Demo.

    >> Does the onOpenFileMenu have a default behavior or UI or do I have to implement both custom in order to make available the option to choose the report type during the creation of a new report?

    The ‘onOpenFileMenu’ does not have a default behavior or UI, it is an Action Handler which when implemented adds a ‘File’ button to your End User Designer. And you can handle the Action you want to perform when clicking the File button such as giving an option to Name and Save your reports, etc.

    You can learn more about more Action Handlers here Action Handlers.

    Thanks,

    Anand

  • Posted 6 September 2024, 8:07 pm EST

    Hi,

    Thank you for answering, I have another couple of questions.

    Just to clarify, I can create a Report Part Library which is a report with report parts but can I create a report that it uses by default a predefined set of report parts? Or the user will always have to drag the report parts into the new report and this process can not be skipped?

    For the Report Parts, I see that there is menu tab that should allow me to define a report tabs, is it enabled to a certain type or report (layout)? So far I create my report based on a object structure (report definition), really don’t know in which type does it fall. Can you provide more info about how the report types are differentiated based on the definition?

    Regards!

  • Posted 9 September 2024, 1:15 am EST - Updated 9 September 2024, 1:20 am EST

    Hi Cesar,

    1. Unfortunately, you do not have report templates in ActiveReportsJS. Therefore the user will have to drag the report parts into the new report as they would like to use it.

      If you’d like to use a report template to reuse a report, you can create a sample report that you would like to reuse, and to copy from the report you can open it make the changes as required and save it as a new report.

    2. To create a report part you can use any of the report layout CPL or FPL, you’ll then need to add any control that you would like to convert to a report part.

    • Now you can right-click on the control and click on ‘Create Report Part’. This will give you an additional tab in the properties for ‘Report Part’.

    • Here you can define pre-defined properties for your report part and save the report.

    • To use the report part in a new ActiveReportsJS report go to ‘File > Add Library’ and select your report (‘.rdlx-json’) which contains your Report Part Controls.

    • Now you can see the Libraries tab in the sidebar populated with the Report Parts you defined in the parent report.

    >> Can you provide more info about how the report types are differentiated based on the definition?

    To learn about how the report types are differentiated based on their definition you may refer to Report Layouts.

    Regards,

    Anand

  • Posted 10 September 2024, 2:36 pm EST

    Hi,

    Thanks for the info, but I think the post provided about the Report Layouts is not enough information.

    That link shows info for the authors guide but I’m looking for the developers guide about Report Layouts, specifically about how to define a report of certain layout like is mentioned in this link https://developer.mescius.com/activereportsjs/docs/DeveloperGuide/api/working-with-report-templates that shows the object definition of a report with a continuous layout and I’m looking for the exact same thing for the rest of layouts (Continuous Page Layout which I think is the one in the link, Fixed Page Layout, and Pageless Layout).

    For the topic about report templates I think I can come up with a workaround, I can just flag as a template (thanks to the way I store the report data) the report that contains my report parts (as you mentioned) and make those reports available in my custom component that should appear on my implementation of the onOpenFileMenu event for the new/create report implementation. Hope you can confirm for me that this is feasible in theory.

    From this, one question comes to my mind about the limitations on report parts. I assume that once a report declares an item as report part that report becomes in a sort of library parts to be shown in the left side toolbar. Does the report should exclude itself of appear on that side menu from his designer view (circular reference kind off) or does the component validates those cases? What if a report is created and tries to use report parts of a report that contains a declared report part and also uses a report part from another report? How does that parts renders in the report library section of the new report? Does the component prevent duplicate references or do I have to make those validations when populating with the setReportsPartsLibraries method?

    Hope these questions aren’t to confusing and that you guys can help me again.

    Regards.

  • Posted 11 September 2024, 4:40 am EST

    Hi Cesar,

    Sure, you can follow the steps mentioned in the link, in brief the link provides you details on how you can use a Reports JSON to create a Report Template which you can then use to load your created report in your designer by using the ‘designer.setReport()’ method.

    After which you’ll need to handle the ‘onSave’ and ‘onSaveAs’ Action handlers for the designer to save the report with a custom name when the end user tries to save the report.

    You may refer to the sample Designer Component - Loading Reports for a developer guide on how to implement the same.

    In the sample, we have three reports two of them are defined as code namely ‘CPLReport’ and ‘FPLReport’, and one of them is fetched from the directory on creating a new report. So when the user clicks on the ‘New Report’ button the ‘onCreate’ action handler overrides the method and loads the custom-created report template.

    When using this approach you do not necessarily need to define report parts. The report parts approach is good when you want to provide controls with specific styles for the report controls such as the font, font size, etc.

    When inheriting from multiple reports for Report Parts you need not worry about duplicate references as when drag-dropping the report parts to your report, the report creates a new copy by copying the code for the entire control instead of referencing to the parent report.

    Please Note: It is recommended to create a separate case for every separate issue as it helps in managing the query and avoids confusion.

    Thanks,

    Anand

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels