How to use oracle Data Adapter with react

Stimulsoft Reports.JS discussion
Post Reply
mtecnic
Posts: 9
Joined: Wed Sep 29, 2021 7:48 am

How to use oracle Data Adapter with react

Post by mtecnic »

Hello,
I have a webservice with asp net core where I created the data adapter like in the example showed in this link https://github.com/stimulsoft/Samples-J ... 0Databases.
This works if I create a page inside the asp net core project with the following code:

Code: Select all

@page
@model Example.Pages.IndexModel
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="shortcut icon" href="favicon.ico" />
    <title>Stimulsoft Reports.JS - ASP.NET Demo</title>

    <!-- Stimusloft Reports.JS -->
    <script src="Scripts/stimulsoft.reports.js" type="text/javascript"></script>
    <script src="Scripts/stimulsoft.viewer.js" type="text/javascript"></script>
    <script src="Scripts/stimulsoft.designer.js" type="text/javascript"></script>
    <script src="Scripts/stimulsoft.blockly.editor.js" type="text/javascript"></script>
</head>
<body onload="onLoad()">
    <script type="text/javascript">
        function onLoad() {
            StiOptions.WebServer.encryptData = false;
            StiOptions.WebServer.url = "/DataAdapters";
            var options = new Stimulsoft.Designer.StiDesignerOptions();
            options.appearance.fullScreenMode = true;
            var designer = new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false);
            designer.renderHtml("content");
            designer.report = new Stimulsoft.Report.StiReport();
        }
    </script>
    <div id="content"></div>
</body>
</html>
The problem is that I have an external app with electron + react and I want to connect the data adapter there, I've tried the following code:

Code: Select all

import React, { useEffect } from "react";
import useStateRef from "../../utils/Hooks/use-state-ref/useStateRef";

import { StiOptions } from "stimulsoft-reports-js/Scripts/stimulsoft.designer";
interface IPropsReportViewer {
  report: string;
}

interface IPropsReportDesigner {
  report?: string;
}

export function ReportDesigner(props: IPropsReportDesigner) {
  let Stimulsoft: any;
  const win: any = window;

  const [designer, setDesigner, designerRef] = useStateRef(null);

  useEffect(() => {
    Stimulsoft = win.Stimulsoft;

    StiOptions.WebServer.encryptData = false;
    StiOptions.WebServer.url = "https://192.168.0.1:44366/DataAdapters";

    var report = Stimulsoft.Report.StiReport.createNewReport();

    var options = new Stimulsoft.Designer.StiDesignerOptions();
    options.appearance.fullScreenMode = true;
    setDesigner(
      new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false)
    );

    designerRef.current.report = report;


    designerRef.current.renderHtml("designerContent");
  }, []);


  return <div id="designerContent"></div>;
}

With this code I get the following error when trying to connect:

https://imgur.com/a/lrvSNzY

How can I add a data adapter with react js?
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: How to use oracle Data Adapter with react

Post by Max Shamanov »

Hello,

Do you get the same error when use the Stimulsoft Adapter ?

Thank you.
mtecnic
Posts: 9
Joined: Wed Sep 29, 2021 7:48 am

Re: How to use oracle Data Adapter with react

Post by mtecnic »

You mean when using the one in this link https://github.com/stimulsoft/Samples-J ... 0Databases ?
Then yes, I get the same error.
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: How to use oracle Data Adapter with react

Post by Lech Kulikowski »

Hello,

Please send us a sample project that reproduces the issue for analysis.

Thank you.
mtecnic
Posts: 9
Joined: Wed Sep 29, 2021 7:48 am

Re: How to use oracle Data Adapter with react

Post by mtecnic »

I attach an electron + react app with the error. The server I used is from your github page https://github.com/stimulsoft/Samples-J ... 0Databases
Attachments
test-electron-react-stimulsoft.zip
(8.83 MiB) Downloaded 103 times
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: How to use oracle Data Adapter with react

Post by Max Shamanov »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: How to use oracle Data Adapter with react

Post by Max Shamanov »

Hello,

We have made some changes in your project, please check the attachments.
Also, we could not reproduce the problem with the client-side connection to oracle.

Thank you.
Attachments
React+electron.zip
(8.88 MiB) Downloaded 96 times
devenv_NxYY6jIdEX.png
devenv_NxYY6jIdEX.png (239.78 KiB) Viewed 1015 times
Post Reply