How to connect the [reports] with flexmosnter data server in angular application.

Answered
lata asked on October 21, 2022

Hi ,
I have integrated the flexmonster in angular application like below - 

<fm-pivot
#pivot  [toolbar]="true" [report]="'http://localhost/sample-index.csv'" [shareReportConnection]="{url: 'http://localhost:9500'}" [height]="600"
(beforetoolbarcreated)="customizeToolbar($event)">>
</fm-pivot>

 
 
And i have  installed the flexmonster data server and admin panel as well, and able to create the index. 
Now i want to provide the connection in [report] attribute of <fm-pivot>  to access the created index but it is throwing me error- 
 
Error - "Unable to open the 'http://localhost/sample-index.csv?462870261' file." 
But this file exist in Flex monster admin panel. So please let me know how can i resolve this to access the creadted index.
 
Regards,
Lata

7 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster October 21, 2022

Hello, Lata,

Thank you for contacting us.

Kindly note that [report] needs to receive a ReportObject containing the structure that shows which data to display. The name of the index should be defined in the DataSourceObject in the report.
For example, the HTML file can look like this:

<fm-pivot
  #pivot
  [toolbar]="true"
  [shareReportConnection]="{url: 'http://localhost:9500'}"
[height]="600"
(beforetoolbarcreated)="customizeToolbar($event)"
  [report]="report">
</fm-pivot>

Then in your TypeScript, you define the report object:

public report: Object = {
    dataSource: {
      "type": "api",
      "url": "http://localhost:9500",
      "index": "sample-index",
    },
  };

You are welcome to check our documentation for reference (Step 2. Configure the report): https://www.flexmonster.com/doc/getting-started-with-data-server/ 

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
lata October 21, 2022

Hi Nadia,
Thanks for your response. 
After changing the .ts file code the way you mentioned above now i am getting the below error- 
ERROR - 
Unable to connect to the custom data source API endpoint 'http://localhost:9500/fields'.

Check the following points to resolve the issue:
- make sure that the URL is correct
- enable CORS
- check the browser console for any errors
and in Flexmonster admin panel my index is  same which i configured in datasource object- 

public report: Object = {
  dataSource: {
    "type": "api",
    "url": "http://localhost:9500",
    "index": "sample-index",
  },
};

PFA
What else i need to configure here to make it work 

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster October 24, 2022

Hello,

Thank you for the response.

Could you please check whether there are any errors or messages in the browser developer console?

Looking forward to hearing from you.

Kind regards,
Nadia

Public
lata October 27, 2022

Plesae find the attcahed screenshot for the errors i am getting.
And in .ts file this is my code ,is that correct way i am caling the MSSQL database.-

public report: Object = {
  dataSource: {
    "type": "api",
    "url": "http://localhost:9500",
    "index": "SummitDB",
  },
};

 

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster October 27, 2022

Hello,

Thank you for the response.

We recommend checking if the Data Server is accessible by opening the URL http://localhost:9500 in the browser.
Are there any issues in the browser developer console or directly on the page?
If the Data Server is accessible, you should see a similar message as when opening our sample Flexmonster Data Server URL https://olap.flexmonster.com:9500/
Also, it would be great if you provide the CORS configuration of your Data Server (it can be found on the Settings page in the Admin Panel)

Looking forward to hearing from you.

Kind regards,
Nadia

Public
lata October 31, 2022

Hi Nadia,
I am completly stucked here , i have enabled the CORS as well in FDS in settings , and when i directly browse the URL http://localhost:9500  it shows - 
Flexmonster Data Server (v. 2.9.36) is up and running
URL: http://localhost:9500
but when i provide the same URL in .ts file in below code and provide the created index in FDS in browser getting 'Unable to connect to the custom data source API endpoint 'http://localhost:9500/fields'.

public report: Object = {
  dataSource: {
    "type": "database",
    "url": "http://localhost:9500",
    "index": "testDB",
  },
};

 
 
And also noticed i am getting the below error in logs folder - 
'Index testDB cannot be loaded. Details: Cannot load data from database executing query "select [Ticket No],Medium,Status from IM_RPT_DN_TicketMaster ".
Please check query or connection string. A network-related or instance-specific error occurred while establishing a connection to SQL Server.
The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
(provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond.'
 
but i rechecked my connectionstring is correct and the same query is working in MSQL server.
 
We need your urgent assiatnce in order to proceed in this.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster October 31, 2022

Hello,

Thank you for the detailed information.

Firstly, the issue appears while retrieving the data from SQL Server. We suppose that your current user has no access to the database. Please try checking the SQL Server Profiler and analyzing the logs from the SQL Server. It may help to find out why it is not accessible. 
Kindly check the permissions and make sure that your current user has access to the database and its tables.

Please let us know if it works for you. Feel free to contact us if other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer