Data visualization component dynamic data binding for data source

Nisarg Thakur
Tera Guru

For the data visualization component, I want to bind the data source dynamically. What is the JSON that it expects? I have the same question for Metric below.

 

NisargThakur_0-1666879755294.png

 

2 REPLIES 2

Nootan Bhat
Kilo Sage

Hello,

Select 'Define Data Manually' under Data resource. (I can see the option in Tokyo version)

NootanBhat_0-1667568416448.png

General JSON format is : 

[{"data":[{"assignment_group":"(empty)","value":"28"},{"assignment_group":"Service Desk","value":"12"},{"assignment_group":"Hardware","value":"9"},{"assignment_group":"Software","value":"9"},{"assignment_group":"Network","value":"6"},{"assignment_group":"Database","value":"2"},{"assignment_group":"Openspace","value":"1"}],"metadata":{"dataSourceLabel":"Incident","eventData":{"table":"incident"},"groupBy":[{"series":[{"id":"value","type":"value","label":"Incident"}],"elements":[{"eventData":{"query":"assignment_group="},"id":"","label":"(empty)"},{"eventData":{"query":"assignment_group=d625dccec0a8016700a222a0f7900d06"},"id":"d625dccec0a8016700a222a0f7900d06","label":"Service Desk"},{"eventData":{"query":"assignment_group=8a5055c9c61122780043563ef53438e3"},"id":"8a5055c9c61122780043563ef53438e3","label":"Hardware"},{"eventData":{"query":"assignment_group=8a4dde73c6112278017a6a4baf547aa7"},"id":"8a4dde73c6112278017a6a4baf547aa7","label":"Software"},{"eventData":{"query":"assignment_group=287ebd7da9fe198100f92cc8d1d2154e"},"id":"287ebd7da9fe198100f92cc8d1d2154e","label":"Network"},{"eventData":{"query":"assignment_group=287ee6fea9fe198100ada7950d0b1b73"},"id":"287ee6fea9fe198100ada7950d0b1b73","label":"Database"},{"eventData":{"query":"assignment_group=36c741fa731313005754660c4cf6a70d"},"id":"36c741fa731313005754660c4cf6a70d","label":"Openspace"}],"id":"assignment_group","fieldType":"reference","label":"Assignment group"}],"format":{"unitFormat":"{0}"},"aggregateBy":4,"metricId":"ZEdGaWJHVnBibU5wWkdWdWRERTJORFl5TXpRMk5qYzBORE09MTY0NjIzNDY2OTQzMw=="}}]

 

 

Create data resource and get the result in above format.

Let me know if it helped.

Kyle_Commette
Tera Contributor

Hello Nisarg,

I was able to get dynamic filtering to work following this article. Also see my attached screenshots

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1156652

 

Basically creating a Data Resource(glideRecord Query) and then creating a page script (Dynamic filter).

 

Once these are completed and associated to each other, you can go to the data visualization and add an event handler.

You'll see the page script that you created. Add it and save. The results wont translate on the builder page but testing it in workspace will show the filter.

Hope this helps!