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?

  • January 18, 2024
  • 4 replies
  • 16 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.

4 replies

marc.v
Level 2
Forum|alt.badge.img+6
  • Level 2
  • Answer
  • January 19, 2024

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+14
  • Level 10
  • January 19, 2024

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
  • January 19, 2024

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
  • January 19, 2024

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