cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custum App & App Functions

zaid-bashir
Frequent Guest

I am developing a Custum App and app function in dynatrace to retrieve data from an API, and I would like to visualize this data using DataTable/DataTableV2. However, I am encountering some issues in the process. 

I appreciate your help by providing a solution or giving me example code for the same.

7 REPLIES 7

StefanKern
Dynatrace Promoter
Dynatrace Promoter

Hello @zaid-bashir,

We have a step-by-step tutorial for API data fetching, putting the data into a DataTable component and more here in the Dynatrace Developer Portal.

For us to be able to help you with your exact problem, please share the related code and error messages.

All the best,

Stefan

zaid-bashir
Frequent Guest

Hello @StefanKern 
For Your Reference, Please Find The Code In An Image Below.

I Am Getting Some JSON Parsing Error and sometimes blank Page.
Can You Help Me By Providing Code Snippet Related To This Issue. For Your Information I Am Accessing AuditLogs.

Screenshot 2024-09-26 094835.png

imsingh
Dynatrace Advisor
Dynatrace Advisor

It seems like you have syntax error in the code.

You should use the curly braces around `result.data` and `</DataTable/>` as following:

{result.data && (
  <DataTable data={auditLogsData} columns={convertToColumns(auditLogsData)}>
  </DataTable/>
)}

  

Thanku For The Update.
But I am still facing issue.

If Possible Then You Can Forward Your Working Version (Audit Logs)
PFA AuditLogs JSX File and App Function File

Screenshot 2024-10-01 141526.png

Screenshot 2024-10-01 141401.png

Hi @zaid-bashir ,
Not Sure if you found a solution for this yet but can you just paste your error here?

 

 

Sometimes all you have to do is do JSON.stringify(data) in the code and then in the DataTable use JSON.parse(data). This ensures that all the JSON data is properly organised with proper formatting.

In your case all you have to do is change these two steps.
const auditLogsData = JSON.stringify(result);

Then in DataTable you change data={JSON.parse(auditLogsData)}

Maheedhar

Thanks @Maheedhar_T

PennyScully
Dynatrace Helper
Dynatrace Helper

Hi @zaid-bashir 

 

Let us know if the above solution works for you, if so, please 'accept as solution'. 

 

Thanks, PEnny 

Featured Posts