Update report dictionary after loading mrt file

Stimulsoft Reports.JS discussion
Post Reply
will
Posts: 3
Joined: Thu Feb 22, 2024 9:51 am

Update report dictionary after loading mrt file

Post by will »

I hope to modify 'databases', 'dataSources', and 'relations' in dictionary after the report calls the loadFile function:

Code: Select all

    const report = new Stimulsoft.Report.StiReport();
    
    report.loadFile(
      'https://treelab-files-upload-staging-v2.treelab.com.cn/nHMwgTMqxZgrjrCDHHBU3L.mrt',
    );

    const database = new Stimulsoft.Report.Dictionary.StiDatabase('MyDatabase');
    report.dictionary.databases.add(database);

    const dataSource = new Stimulsoft.Report.Dictionary.StiDataSource(
      'MyDataSource',
      'MyDataSource',
    );
    
    report.dictionary.dataSources.add(dataSource);

    designer.report = report;

    designer.renderHtml('designer');
But MyDataSource does not appear in MyDatabase:

Image

I couldn't establish a relationship between 'databases' and 'dataSources'. I have reviewed their interface definitions, but it seems that there are no relevant functions to associate them. Are there any examples that i can refer to?
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: Update report dictionary after loading mrt file

Post by Lech Kulikowski »

Hello,

You should set the nameInSource:
https://admin.stimulsoft.com/documentat ... onstructor

In your case:

Code: Select all

const dataSource = new Stimulsoft.Report.Dictionary.StiDataSource(
      'MyDatabase',
      'MyDataSource',
      'MyDataSource',
    );
Thank you.
Post Reply