Connecting Plugin to Regular Report

To enhance capabilities of building a regular report one can connect a plugin on a new report sheet. A plugin can be similarly connected to a data entry form.

NOTE. A plugin can be connected to a regular report only in the web application and in the designer of business applications.

To connect a plugin to a regular report:

  1. Add the plugin files <plugin name>.js and <plugin name>.css to the folder with installed web application or designer of business applications.

The path to the folder with installed web application:

The path to the folder with installed designer of business applications:

TIP. To facilitate the use of plugins, create the plugins folder, which will store plugins.

  1. Add plugin description in the PP.xml configuration file for the web application or DBA.config.json for the designer of business applications.

To describe the plugin in the PP.xml file, use the <plugins> section:
<plugins>
    <plugin type="PP.Ui.Prx.MyLabel" path="../plugins/MyLabel.js" css="../plugins/MyLabel.css" name="MyLabel" loaded="true"/>
    <plugin ... />
</plugins>
To describe the plugin in the DBA.config.json file, use the plugins:
"plugins": [
    {
        "Type": "PP.Ui.Prx.MyLabel", //plugin identifier corresponding to object instance type
        "Path": "../plugins/MyLabel.js", //relative path to plugin JS file
        "Css": "../plugins/MyLabel.css", //relative path to CSS file with plugin styles
        "Name": "MyLabel", //plugin name
        "Loaded": true //plugin loading method
    },
    {
        ...
    }
]

IMPORTANT. The following identifiers are reserved for the preset plugins: PP.Ui.Dashboard.Sankey - Sankey Chart; PP.Ui.Dashboard.Gantt - Gantt Chart; PP.Ui.Dashboard.Indicator - Indicator. Make sure that the "type" attribute has the identifier that is different from the reserved ones.

  1. Restart the web server.

  2. Create a sheet with the plugin in the regular report. A sheet with the plugin can be created in the development environment in the Fore programming language using the IPrxJsPlugin.PluginId property. The example displays a regular report with the REPORT identifier and a plugin with the PP.Ui.Prx.MyLabel identifier.

Add links to the Metabase and Report system assemblies and execute the unit:

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    Sheets: IPrxSheets;
    Sheet: IPrxSheet;
    Plugin: IPrxJsPlugin;
Begin
    MB := MetabaseClass.Active;
    // Get regular report
    MObj := MB.ItemById("REPORT").Edit;
    Report := MObj As IPrxReport;
    // Add a new sheet with plugin
    Sheets := Report.Sheets;
    Sheet := Sheets.Add("Sheet with plugin", PrxSheetType.JsPlugin);
    Plugin := Sheet As IPrxJsPlugin;
    Plugin.PluginId := "PP.Ui.Prx.MyLabel";
    // Save changes
    MObj.Save;
End Sub UserProc;

After executing the operations, a new sheet with connected plugin will be added in the regular report.

NOTE. The sheet with connected plugin cannot be export and print.

See also:

Plugins