Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
VaishnaviMogal2
Contributor III
Contributor III

Store values of corresponding fields of selected row in variable

Hi,

Can we select the row in one click in qlik sense. whenever a user clicks on any row value in the table, the corresponding field values will be stored in the variable. and will use this variables as filter for another graph. (I know I can achieve this using set analysis.) but how can i store field values of selected row. if i click any dimension value, it selects only this individual value and ,measure values are not selectable in table.

another thing is I have to show all date values after the selected date. 

Can we achieve this in Qlik Sense, any Suggestion please reply.

Thanks,

Labels (4)
7 Replies
SunilChauhan
Champion II
Champion II

Use Below 

Set Variable = getfieldselections(FieldName);

 

And Use $(Variable) to evaluate value

Sunil Chauhan
TauseefKhan
Creator III
Creator III

Hi @VaishnaviMogal2,
1- Create a variable in the script:

Set vSelectedValues = GetFieldSelections(YourFieldName);
Set vMaxSelectedDate = Date(Max(DateField));

2- Use the variable in the set analysis of another chart to filter based on the selected values. For example:

Sum({<YourField={$(vSelectedValues)}>} Sales)


3- Use set analysis with a variable that captures the maximum selected date.

=If(DateField > vMaxSelectedDate, Count(Measure))

And you can set the vMaxSelectedDate variable using a trigger when the selection changes:

The chart will show all values after the selected date. Remember to replace DateField and Measure with your actual field names.

 *** When applicable please mark the correct/appropriate replies as "solution". Please LIKE threads if the provided solution is helpful to. ***

 

VaishnaviMogal2
Contributor III
Contributor III
Author

@TauseefKhan @SunilChauhan  Thanks for reply. but this is not meeting my requirements. please refer to image 

VaishnaviMogal2_0-1716271619544.png

suppose if I click on charge session 1 then that row's corresponding vin,start date and end date should be stored in respective 3 variables i.e., Vvin,VstartDate and VendDate. is this possible in Qlik sense?.
Thanks in advance.

Vaishnavi,

SunilChauhan
Champion II
Champion II

use your actual field name of vvin, Startdate and End Date in below expression Respectively.

Set Vvin={'$(=ONLY({<[Change Session]= {"$(=GetFieldSelections([Change Session]))"}>} VinHeader))'}
Set VstartDate ={'$(=ONLY({<[Change Session]= {"$(=GetFieldSelections([Change Session]))"}>} Expected Start Time))'}
Set VEndDate ={'$(=ONLY({<[Change Session]= {"$(=GetFieldSelections([Change Session]))"}>} Expected EndTime))'}

 

Sunil Chauhan
VaishnaviMogal2
Contributor III
Contributor III
Author

HI @SunilChauhan , Thanks!

Now I am getting the values in  variables. but it's not working when I'm using these variables to filter another graph. I am using below expression to get data between start date and end date but this expr giving  - 

if(DateTime >= $(VStartDate) and DateTime <= $(VEndDate),DateTime)

Please correct me if I'm wrong in expr.

 

SunilChauhan
Champion II
Champion II

May be it will work in SIngle quote , try some other options

if(DateTime >= '$(VStartDate)' and DateTime <= '$(VEndDate)',DateTime)

or 

try without $ sign

if(DateTime >=VStartDateand DateTime <=VEndDate,DateTime)

 

Sunil Chauhan
marcus_sommer

It sounds like an unsuitable approach because the aim should be to associate everything needed within the data-model and then the user just selects the wanted views and values. Of course, many things are possible within the UI but usually it's a detour and much harder and with disadvantages in regard to the performance and usability.