Instead of a database connection, you can pass an in-memory DataSet directly to the report.

Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
import { Viewer, Stimulsoft } from 'stimulsoft-reports-js-react/viewer';


function App() {
    const [report, setReport] = useState<Stimulsoft.Report.StiReport>();

    function updateReport(dataSet: Stimulsoft.System.Data.DataSet) {
        var report = new Stimulsoft.Report.StiReport();
        report.loadFile('Reports/TwoSimpleLists.mrt');
        report.dictionary.databases.clear();
        report.regData('Demo', 'Demo', dataSet);
        setReport(report);
    }

    function buttonXmlClick() {
        var dataSet = new Stimulsoft.System.Data.DataSet();
        dataSet.readXmlSchemaFile('Data/Demo.xsd');
        dataSet.readXmlFile('Data/Demo.xml');

        updateReport(dataSet);
    }

    function buttonJsonClick() {
        var dataSet = new Stimulsoft.System.Data.DataSet();
        dataSet.readJsonFile('Data/Demo.json');

        updateReport(dataSet);
    }

    return (
        <div className='container'>
            <div className='container-button'>
                <button onClick={buttonXmlClick} className='button'>Register XML Data</button>
                <button onClick={buttonJsonClick} className='button'>Register JSON Data</button>
            </div>
            <div>
                <Viewer report={report} />
            </div>
        </div>
    );
}

export default App;

The DataSet is populated with readXmlFile/readXmlSchemaFile or readJsonFile, then handed to the report through regData(). Clearing dictionary.databases first removes the design-time connection.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.