Dynamic Data Binding for TimeSeries Data Visualization Component UI Builder

ezhilzrec
Tera Contributor

I've created a data resource of type Transform in UI Builder to return the trend of closed incidents as JSON and im trying to bind this data resource to a Column Time Series Data Visualization Component.

 

However i'm not able to get it working as im not sure of the format of JSON that is to be used in the data, metric/TrendBy.

 

Is this even feasible thing to do and if so Can anyone share a working example?

 

Tagging @Nootan Bhat since he had responded on similar question. Would appreciate any pointers.

 

https://www.servicenow.com/community/developer-forum/ui-builder-single-score-make-filter-with-bind-d...

15 REPLIES 15

Hello Nootan bhat

Where do u get the values for "trend" configuration. how did u learn that was the json it was expeting. im trying to figure it that out. couse everything u post it actually works!!! and u are the only person i have seen that figured it out and i want to config the group by. but i dont know where i can see the json config it is expecting. 

thanks for reading this.

Thank you @Nootan Bhat  i was able to make my transform datasource return JSON in this format to get the report working. But i realised i lost the flexibility to choose the params like trendBy, GroupBy, Frequency which is also needed for my usecase.

Hi @ezhilzrec,

You can do the trendBy, GroupBy using the dynamic data binding. The trendby solution is mentioned in my 2nd comment.

I have added this comment considering the simplest solution. If you want to add the groupBy use below code:

  var groupBy = [ {
            "maxNumberOfGroups" : 10,
            "numberOfGroupsBasedOn" : "NO_OF_GROUP_BASED_ON_PER_METRIC",
            "showOthers" : false,
            "groupBy" : [ {
              "dataSource" : "DVID",
              "groupByField" : "state",
              "isRange" : false,
              "isChoice" : true,
              "isPaBucket" : false
            } ],
            "disableRanges" : false
          } ];
	return groupBy;

 

If you are using transform script either you can return the data visualization data as format mentioned in my 1st comment. Or else you can return these codes as part of your transform script and use it in the data sources as a dynamic value.
There is no need to use the transform script since dynamic data binding can be achieved by scripts itself using the client state parameters.

 

I did not see the frequency option in the static input for column type visualization.

 

Please mark the reply as correct if it helped.

 

Thanks

 

instance
Tera Contributor

@Nootan Bhat  How to do for Filter component and List component .?

@Nootan Bhat , is there any way by which we can show weekly date range instead of weeks in a week trend report. As shown in the picture below, it is a weekly trend report but inplace of weeks on the x axis, I want to show date range of that week. is it possible.  Screenshot 2024-11-12 at 2.25.05 PM.png