Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
RK007
Contributor II
Contributor II

How to Select field Dynamically using the Button Action

Hi Everyone,

How can I setup the field dynamically using the button action (New version)

I do have a Button for navigation object (which was an older version button, currently this object is not available), to set up period values such as YTD, QTD, etc. Based on these period values, the button is setting up the field dynamically.

The older button has an action Define the field using the expression, the new button doesn't have this action.

I have added a few screens for reference.

Ramakoti01_0-1680007203054.png

Can you please help me to achieve this functionality or any alternatives if possible?

thanks in advance 

Ramakoti

Labels (3)
3 Replies
Mike_Dickson
Support
Support

Hello @RK007 

I wanted to take a shot at this and maybe help out or point in the right direction:

How to Select field Dynamically using the Button Action

To select a field dynamically using a button action in Qlik, you can use the "Select in Field" action. This action allows you to select one or more values in a field based on a condition.
Here's an example of how to use the "Select in Field" action to select a field dynamically using a button action in Qlik:
1. Create a button object in your Qlik app.
2. In the button properties, go to the "Actions" tab and click "Add".
3. Select "Select in Field" as the action type.
4. In the "Field" dropdown, select the field you want to select values from.
5. In the "Search String" box, enter the expression that defines the values you want to select dynamically. For example, you could use an if statement to select values based on a condition:

=if(period = 'YTD', 'YearToDate', if(period = 'QTD', 'QuarterToDate', ''))

(In this example, the "period" variable is used to determine which values to select in the "Field" dropdown. If "period" is "YTD", the expression selects all values in the "YearToDate" category. If "period" is "QTD", the expression selects all values in the "QuarterToDate" category. If "period" is anything else, the expression selects no values.)

6. Click "OK" to save the action and close the dialog.
7. Test the button by clicking it and verifying that the correct values are selected in the field.
Note that you can also use the "Toggle Select" action to select or deselect values in a field based on a condition. This can be useful if you want to allow the user to toggle between different sets of values in the same field.

Here are some additional sources:

https://community.qlik.com/t5/QlikView-App-Dev/Using-Select-in-field-action-for-multiple-selections/...

https://community.qlik.com/t5/QlikView-App-Dev/Button-Actions-Select-in-Field-multiple-values/td-p/1...

 

Sr. Technical Support Engineer with Qlik Support
Don't forget to mark a solution that worked for you!
RK007
Contributor II
Contributor II
Author

Hi @Mike_Dickson 

thank you so much for your response, it helped me to make multiple selections.

But, I need more clarity on my primary requirement, I have added more info about my requirement.

how can select the field dynamically (the field is being created using the zBOSDate variable, we have created the flags for all the period values on the script side).

After selecting the period from the drop-down, if the user clicks on the button it's selecting the field based on the period and sets up the values in that field. 

I am not able to achieve it, can you provide me with any solution or alternative for this?

I do have a Button for navigation object (which was an older version button, currently this object is not available), to set up period values such as YTD, QTD, etc.

It has 3 actions

1: Set Variable Value 

Ramakoti01_3-1680255490176.png

2: Clear Selections in a Field - using an action - Define the Field using an expression (this action is not available in the new button object) - this action clears the field selection based on the Period ranges

Ramakoti01_4-1680255490182.png

3: Select a value in a Field - using an action - Define the Field using an expression (this action is not available in the new button object)

This action sets up the field based on the selection in the period drop-down (YTD, QTD, etc, variable is zBOSStateBCalendarField),  for all these periods, we have created flags in the script level to set up the date ranges.

Ramakoti01_5-1680255490183.png

currently, these are not working, can anybody helps me to find a better solution to achieve this functionality?

let me know if any further info is required...

RK007
Contributor II
Contributor II
Author

hi @Mike_Dickson 

do you have any solution or any alternative for the above problem?

I really appreciate any help you can provide.