How to hide data visualization in UI builder if there is no data

gowthamaa_mohan
Tera Contributor

I have a requirement in UI Builder -  I need to hide the data visualization component if there is no data in the component, Kindly help me with the scripting.

8 REPLIES 8

Guido Bernuetz
Giga Guru

I have done this multiple times for the Loader component. But you can do this for any other component.

 

  • Create a client state to save the visibility (true/false)

GuidoBernuetz_0-1711796298490.png

 

  • set this client state value by a special data broker or by a client script

GuidoBernuetz_1-1711796331835.png

It's done by a data broker result in this example

 

  • Assign the visibibility of your component to the client state or use a little client script

 

GuidoBernuetz_5-1711797047347.png

 

It's done by a client script in this example 

 

GuidoBernuetz_3-1711796408594.png

 

I hope this helps you! If "yes" give me a Helpful.  😉

I am not a helpful hunter.
I will always try to give a meaningful and valid answer.

 @Guido Bernuetz   Thanks for the reply!!

 

I have tried your solution in my data visualization component, but it is not working., 

 

Actually i am trying to do the whenever the data or records is zero, i need to hide the component(Data Visualization) and if the record count is more than zero i want to show the component.

Dibyaratnam
Tera Sage

@gowthamaa_mohan please find below 2 images, where I have added a OOB data resource "Look Up multiple records" and given the conditions as what you have mentioned in your Data script above.

This will give some output in an array. If that Array length is zero, then in that case, you will hide the Data viz. component.

 

DSam1_1-1711976258701.png

DSam1_2-1711976278501.png

DSam1_3-1711976294116.png

 

 

 

 

This worked perfectly for my needs -- thank you!