Page 1 of 1

Update report dictionary after loading mrt file

Posted: Thu Feb 22, 2024 1:09 pm
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?

Re: Update report dictionary after loading mrt file

Posted: Fri Feb 23, 2024 9:51 am
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.