Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
GrantBooth
Creator

Container Object Selection as a Condition

I'm trying to make the information contained in a text box change depending on the selection of an object in a container.

So if a user selects Labour Costs, they will see a certain body of text in the text box to the right

GrantBooth_0-1634607334922.png

 

And if they select Labour Costs by Business Unit they will see different text

GrantBooth_1-1634607426206.png

Is this possible to do?

2 Solutions

Accepted Solutions
Andrei_Cusnir
Specialist

Hello,

 

If my understanding is correct, you want to choose different visualizations to display in the container and based on the selection, you would like to update the text in the "Text & image" object. This use case scenario natively is not supported however the logic behind it is: Every time the a tab is selected in the Container object, a public variable would get updated as well and this variable would have the text that you want to display. I would suggest you to create a Feature Request [1] and elaborate in detail why this would be beneficial for you.

 

Although natively it is not supported, you can achieve a similar behavior with the use of Variable input object. Here are the steps that I have followed:

  1. Create the following variables:
  2. The varSelected1 and varSelected2 are the text that you want to display in the Text & image object
  3. The varSelectedContainer is the the actively selected tab in the container
  4. Create a Container with two different Bar charts
  5. For the first Bar chart add Show condition "=varSelectedContainer=1"
  6. For the second Bar chart add Show condition = "=varSelectedContainer=2
  7. Create a new Input variable object with the details:
  8. Appearance > Variable > Name : varSelectedContainer
  9. Appearance > Variable > Show as: Drop down
  10. Appearance > Values > Fixed or dynamic values : Dynamic
  11. Appearance > Values > Dynamic values : ='1~Yearly|2~Monthly'
  12. Now create the Text & image object and add measure: "=Pick(varSelectedContainer, varSelected1, varSelected2)"

What is going to happen in this use case scenario:

  1. On the Container object you will only see the chart that is current selected
  2. When you choose different option form Variable input object the public variable varSelectedContainer is going to be updated with 1 or 2
  3. The conditions in the Container object will update the visualization that you see
  4. The expression in the Text & image object will update the text that is presented

What happens when you choose values in the Variable input:

 

I believe this is as close as you can get to your use case scenario. I hope that this information was helpful.     

 

---

[1] https://community.qlik.com/t5/Knowledge-Base/How-To-Submit-Feature-Requests-For-Qlik-Products/ta-p/1...

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

Andrei_Cusnir
Specialist

Hello,

 

Please take a look at my following approach and let me know if this has helped you resolve the second issue:

  1. I did my reproduction for 3 Departments (DepartmentA, DepartmentB and DepartmentC), with 3 charts for each department (Chart1, Chart2 and Chart3) and a unique commentary for each department and chart combination. So my dataset looks like:
  2. Then I have created the following variables:
  3. After that, I have created 2 Variable input objects with the following Dynamic values:
    ='1~Department A|2~Department B|3~Department C' for the Departments
    ='1~Chart 1|2~Chart 2|3~Chart 3' for the Charts
  4. For the container I have created 9 charts in total. 3 for each department and for the Show conditions I have used (accordingly):
    ='$(varSelectedDepartment)' = 1 and '$(varSelectedChart)' = 1
    ='$(varSelectedDepartment)' = 1 and '$(varSelectedChart)' = 2
    ='$(varSelectedDepartment)' = 1 and '$(varSelectedChart)' = 3
    ='$(varSelectedDepartment)' = 2 and '$(varSelectedChart)' = 1
    ='$(varSelectedDepartment)' = 2 and '$(varSelectedChart)' = 2
    ='$(varSelectedDepartment)' = 2 and '$(varSelectedChart)' = 3
    ='$(varSelectedDepartment)' = 3 and '$(varSelectedChart)' = 1
    ='$(varSelectedDepartment)' = 3 and '$(varSelectedChart)' = 2
    ='$(varSelectedDepartment)' = 3 and '$(varSelectedChart)' = 3
  5. As soon as those configurations are in place, I have created a new Text & image object with the following measure expression:

    Only({<

      Department={"$(=Pick('$(varSelectedDepartment)', 'DepartmentA', 'DepartmentB', 'DepartmentC'))"}, 
     
    Chart={"$(=Pick('$(varSelectedChart)', 'Chart1', 'Chart2', 'Chart3'))"}

    >}Commentary)

  6. This expressions uses the Function Pick() which will return the Department and Chart title based on the selections in the variables. Additionally the Set expression will show only the commentary from the dataset where the criteria are matched. e.g. Only where Department field equals with DepartmentA and at the same time the Chart field equals with Chart1 etc.

This is the result that I have:

 

As you can see when the Department A and Chart 1 are selected, the corresponding message is displayed in Text & image object. The same thing happens for when the Department C and Chart 1 are selected etc. If my understanding, of your use case scenario, is correct, then I believe that this is the closest that you can get to your expected output.

 

if this has helped you resolved the second issue, please mark it as solution to the issue as well. This will allow other community members to find this answer easily in case they need to. 

 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

5 Replies
Andrei_Cusnir
Specialist

Hello,

 

If my understanding is correct, you want to choose different visualizations to display in the container and based on the selection, you would like to update the text in the "Text & image" object. This use case scenario natively is not supported however the logic behind it is: Every time the a tab is selected in the Container object, a public variable would get updated as well and this variable would have the text that you want to display. I would suggest you to create a Feature Request [1] and elaborate in detail why this would be beneficial for you.

 

Although natively it is not supported, you can achieve a similar behavior with the use of Variable input object. Here are the steps that I have followed:

  1. Create the following variables:
  2. The varSelected1 and varSelected2 are the text that you want to display in the Text & image object
  3. The varSelectedContainer is the the actively selected tab in the container
  4. Create a Container with two different Bar charts
  5. For the first Bar chart add Show condition "=varSelectedContainer=1"
  6. For the second Bar chart add Show condition = "=varSelectedContainer=2
  7. Create a new Input variable object with the details:
  8. Appearance > Variable > Name : varSelectedContainer
  9. Appearance > Variable > Show as: Drop down
  10. Appearance > Values > Fixed or dynamic values : Dynamic
  11. Appearance > Values > Dynamic values : ='1~Yearly|2~Monthly'
  12. Now create the Text & image object and add measure: "=Pick(varSelectedContainer, varSelected1, varSelected2)"

What is going to happen in this use case scenario:

  1. On the Container object you will only see the chart that is current selected
  2. When you choose different option form Variable input object the public variable varSelectedContainer is going to be updated with 1 or 2
  3. The conditions in the Container object will update the visualization that you see
  4. The expression in the Text & image object will update the text that is presented

What happens when you choose values in the Variable input:

 

I believe this is as close as you can get to your use case scenario. I hope that this information was helpful.     

 

---

[1] https://community.qlik.com/t5/Knowledge-Base/How-To-Submit-Feature-Requests-For-Qlik-Products/ta-p/1...

Help users find answers! Don't forget to mark a solution that worked for you! 🙂
GrantBooth
Creator
Author

Thank you so much, that's the most helpful response I've had on the forums.

GrantBooth
Creator
Author

@Andrei_Cusnir   I was wondering if you might be able to provide a little more help here. I've implemented the solution that you recommended, and it's been working very well there's just one final piece to the puzzle.

I am needing to work with a large number of different commentaries, there's 11 departments with an average of 5 objects each, each month, that need their own commentary, so creating a variable for each permutation is not possible.  In order to overcome this, I've imported a fact table with columns Period, Department Description, Chart and Commentary, which has been loaded successfully.

I would like it that when a user selects a department, month and chart it will then produce the commentary. This works except for the chart field - I am trying to make Qlik select the chart field corresponding to the variable selected from the dropdown. So I'm tying to do something like

If v.SelectedContainer = 1, Chart = 1

I have been able to get this to work if I use a button to show commentary - i've used action Select Values matching search criteria, and set the value to $(v.SelectedContainter) This works perfectly, so the data is sound, but it's obviously not ideal to have users having to press an extra button to show this commentary.  Is there a way I can implement this in one step?

 

Andrei_Cusnir
Specialist

Hello,

 

Please take a look at my following approach and let me know if this has helped you resolve the second issue:

  1. I did my reproduction for 3 Departments (DepartmentA, DepartmentB and DepartmentC), with 3 charts for each department (Chart1, Chart2 and Chart3) and a unique commentary for each department and chart combination. So my dataset looks like:
  2. Then I have created the following variables:
  3. After that, I have created 2 Variable input objects with the following Dynamic values:
    ='1~Department A|2~Department B|3~Department C' for the Departments
    ='1~Chart 1|2~Chart 2|3~Chart 3' for the Charts
  4. For the container I have created 9 charts in total. 3 for each department and for the Show conditions I have used (accordingly):
    ='$(varSelectedDepartment)' = 1 and '$(varSelectedChart)' = 1
    ='$(varSelectedDepartment)' = 1 and '$(varSelectedChart)' = 2
    ='$(varSelectedDepartment)' = 1 and '$(varSelectedChart)' = 3
    ='$(varSelectedDepartment)' = 2 and '$(varSelectedChart)' = 1
    ='$(varSelectedDepartment)' = 2 and '$(varSelectedChart)' = 2
    ='$(varSelectedDepartment)' = 2 and '$(varSelectedChart)' = 3
    ='$(varSelectedDepartment)' = 3 and '$(varSelectedChart)' = 1
    ='$(varSelectedDepartment)' = 3 and '$(varSelectedChart)' = 2
    ='$(varSelectedDepartment)' = 3 and '$(varSelectedChart)' = 3
  5. As soon as those configurations are in place, I have created a new Text & image object with the following measure expression:

    Only({<

      Department={"$(=Pick('$(varSelectedDepartment)', 'DepartmentA', 'DepartmentB', 'DepartmentC'))"}, 
     
    Chart={"$(=Pick('$(varSelectedChart)', 'Chart1', 'Chart2', 'Chart3'))"}

    >}Commentary)

  6. This expressions uses the Function Pick() which will return the Department and Chart title based on the selections in the variables. Additionally the Set expression will show only the commentary from the dataset where the criteria are matched. e.g. Only where Department field equals with DepartmentA and at the same time the Chart field equals with Chart1 etc.

This is the result that I have:

 

As you can see when the Department A and Chart 1 are selected, the corresponding message is displayed in Text & image object. The same thing happens for when the Department C and Chart 1 are selected etc. If my understanding, of your use case scenario, is correct, then I believe that this is the closest that you can get to your expected output.

 

if this has helped you resolved the second issue, please mark it as solution to the issue as well. This will allow other community members to find this answer easily in case they need to. 

 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂
GrantBooth
Creator
Author

Thank you so much again, you've been so helpful. Cheers mate 🙂