Skip to main content
Solved

I'm working with views and I'd like to show a chart only when a runtime varible has specific value. How can I do that?

  • Jan 18, 2024 5:07 PM UTC
  • 4 replies
  • 185 views

Forum|alt.badge.img+11
I'm working with views and I'd like to show a chart only when a runtime varible has specific value. How can I do that?

Best answer by marc.v

One possible setup is by having 3 views:

  • The main view where you plan to display or not the graph.
  • A view containing only the graph.
  • An empty view.

Then, you can add the embedded view component in the main view and customize it with the logic you mention regarding the value of the variable to display the view containing the graph or the empty one.

View original

4 replies

marc.v
Level 2
Forum|alt.badge.img+6
  • Level 2
  • Answer
  • Jan 19, 2024 8:19 AM UTC

One possible setup is by having 3 views:

  • The main view where you plan to display or not the graph.
  • A view containing only the graph.
  • An empty view.

Then, you can add the embedded view component in the main view and customize it with the logic you mention regarding the value of the variable to display the view containing the graph or the empty one.


Sverre Klein
Level 10
Forum|alt.badge.img+13

Hi Alice, to help you a bit burther, could you provide your current code / setup of your chart?

 

In your case, as a simple start, The CASE WHEN statement is the way to go. It would look something like this:

 

CASE WHEN <%=Variable_name%> = 'Your Specific Value' THEN 1 ELSE NULL END

 

Let me know if this worked or if you need further help :)


Forum|alt.badge.img+11
  • Author
  • Level 2
  • Jan 19, 2024 9:07 AM UTC

One possible setup is by having 3 views:

  • The main view where you plan to display or not the graph.
  • A view containing only the graph.
  • An empty view.

Then, you can add the embedded view component in the main view and customize it with the logic you mention regarding the value of the variable to display the view containing the graph or the empty one.

Thank you very much Marc! I've solved my problem!😍


Forum|alt.badge.img+11
  • Author
  • Level 2
  • Jan 19, 2024 9:08 AM UTC

Hi Alice, to help you a bit burther, could you provide your current code / setup of your chart?

 

In your case, as a simple start, The CASE WHEN statement is the way to go. It would look something like this:

 

CASE WHEN <%=Variable_name%> = 'Your Specific Value' THEN 1 ELSE NULL END

 

Let me know if this worked or if you need further help :)

Thank you Sverre for your idea, I've managed to solve my problem in the way Marc suggested me