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.

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. In the Plugins folder create the CSS folder that will store plugin styles.

  1. Add a plugin description in the configuration file:

To describe plugin in the PP.xml web application file, use the <plugins> section:

<plugins>
    <plugin type="PP.Ui.Prx.MyLabel" path="../Plugins/MyLabel.js" css="../Plugins/CSS/MyLabel.css" name="MyLabel" loaded="true"/>
    <plugin ... />
</plugins>

To describe plugin in the DBA.config.json file of designer of business application, use the plugins field:

"plugins": [
    {
        "Type": "PP.Ui.Prx.MyLabel",
        "Path": "./Plugins/MyLabel.js",
        "Css": "./Plugins/CSS/MyLabel.css",
        "Name": "MyLabel",
        "Loaded": true
    },
    {
        ...
    }
]

In the config.json configuration file for the web application or config.json file for designer of business applications, one can connect plugins to dashboards, connect custom chart templates, connect external map services.

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 back end of web application/designer of business applications.

  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