How to define JSON for Pivot table data source, metrics and grouby in UI builder Data Vizualization?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 12:56 AM
Hi Team,
I am working on the UI builder Data vizualization component and wants to create pivot table. I need to help to define JSON formats for "use script" method to add data sources, metrics and groupby?
Can anyone help me around to make JSON format script for pivot table?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 11:05 PM
Any reason you want to script them?
If you want to use different data sources based on certain conditions then you can use multiple data visualization components and then show/hide them based on these conditions.
ServiceNow Community Rising Star 2022/2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 11:17 PM
Hi @JagjeetSingh ,
I am using state variable for dynamic filtering, In data source section in pivot table component, I've passed JSON object in use script , e.g
[{
"isDatabaseView": false,
"allowRealTime": true,
"label": "Cost details",
"sourceType": "table",
"tableOrViewName": "<table_name>",
"filterQuery": api.state.filterValue,
"reportSourceSysId": null,
"id": <generated_id>
}];
Likewise I've looking for the format of passing groupBy fields in pivot table component.