Having issue with trendby in spline data visualization component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 08:48 PM - edited 04-21-2024 08:51 PM
Hi All,
I am new to ui builder, I have added data visualization component and set type is Spline. As I want to pass dynamic filter based on date added in filter
Data sources -
function evaluateProperty({api, helpers}) {
var data = [ {
"isDatabaseView": false,
"allowRealTime": true,
"sourceType": "table",
"label": {
"message": "LABEL OF YOUR DV"
},
"tableOrViewName": "task", // tablename
"filterQuery": "opened_atBETWEENjavascript:gs.dateGenerate('"+api.state.startDate+"','00:00:00')@javascript:gs.dateGenerate('"+api.state.endDate+"','23:59:59')",//based on filter bind value
"id": "SPLINEDVID"
}];
console.log("data = "+JSON.stringify(data));
return data;
}
Metric script :
/**
* {params} params
* {api} params.api
* {TransformApiHelpers} params.helpers
*/
function evaluateProperty({
api,
helpers
}) {
var metric = [{
"dataSource": "SPLINEDVID",
"id": "METRICID",
"aggregateFunction": "COUNT",
"aggregateField":"",
"numberFormat": {
"customFormat": false
},
"axisId": "primary"
}];
return metric;
}
Trend by script :
/**
* {params} params
* {api} params.api
* {TransformApiHelpers} params.helpers
*/
function evaluateProperty({
api,
helpers
}) {
var metric = [{
"dataSource": "SPLINEDVID",
"id": "METRICID",
"aggregateFunction": "COUNT",
"aggregateField":"",
"numberFormat": {
"customFormat": false
},
"axisId": "primary"
}];
return metric;
}
It was showing below error in dashboard
Anyone have any idea what i am missing here in trendby script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 09:34 PM
why is your metric and trendby script same?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2024 03:22 AM
no both are different
Data source -
function evaluateProperty({api, helpers}) {
return[{
"isDatabaseView": false,
"allowRealTime": true,
"sourceType": "table",
"label": {
"message": "LABEL OF YOUR DV"
},
"tableOrViewName": "task", // tablename
// "filterQuery": "opened_atBETWEENjavascript:gs.dateGenerate('"+api.state.startDate+"','00:00:00')@javascript:gs.dateGenerate('"+api.state.endDate+"','23:59:59')",//based on filter bind value
"filterQuery":"opened_atBETWEENjavascript:gs.dateGenerate('2023-07-01','00:00:00')@javascript:gs.dateGenerate('2024-04-22','23:59:59')",
"id": "SPLINEDVID"
}];
}
Metric script
/**
* @Param {params} params
* @Param {api} params.api
* @Param {TransformApiHelpers} params.helpers
*/
function evaluateProperty({
api,
helpers
}) {
return [{
"dataSource": "SPLINEDVID",
"id": "METRICID1",
"aggregateFunction": "COUNT",
"aggregateField":"",
"numberFormat": {
"customFormat": false
},
"axisId": "primary"
}];
}
Trend by
/**
* @Param {params} params
* @Param {api} params.api
* @Param {TransformApiHelpers} params.helpers
*/
function evaluateProperty({api, helpers}) {
return {
"trendByFrequency": "date",
"trendByFields": [{
"field": "sys_updated_on",
"metric": "METRICID1"
}]
};
}