Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Select value in one field on selection of a value in another field

Hi All,

I have a field called InvoicePeriod, and in order to measure one InvoicePeriod against another InvoicePeriod, I have assigned a serial number (I have called this field InvoicePeriodNumber).

I'd like to be able to select a value in my InvoicePeriod list box and for this to trigger a selection in my InvoicePeriodNumber field so that I can have expressions based on InvoicePeriodNumber vs. InvoicePeriodNumber - 1 for example.

There is always a one-to-one relationship between the two fields, however I'm just not sure how to force a selection on InvoicePeriodNumber when a selecetion is made based on InvoicePeriod. I've tried adding triggers, but can't seem to get it to work!

Any help greatly appreciated!

1 Solution

Accepted Solutions
Highlighted
Not applicable

Hi,

try to add a Field Event Trigger OnSelecti of InvoicePeriod field with:

Select In Field Action with

Field: InvoicePeriodNumber

Search String: =only({<InvoicePeriod={'$(=only(InvoicePeriod))'}>}InvoicePeriodNumber)

Hope this helps

MC


View solution in original post

6 Replies
Highlighted
Not applicable

Hi,

try to add a Field Event Trigger OnSelecti of InvoicePeriod field with:

Select In Field Action with

Field: InvoicePeriodNumber

Search String: =only({<InvoicePeriod={'$(=only(InvoicePeriod))'}>}InvoicePeriodNumber)

Hope this helps

MC


View solution in original post

Highlighted
Creator
Creator

This works perfectly, thank you so much for your help!

Highlighted
Not applicable

Hi MC,

That's great ! Thanks.

How do you make it work if you one to many relationship.

like.. One selection has multiple possible values in the other field??

Thanks & Regards,

Sandip Patel.

Highlighted
Contributor III
Contributor III

I believe you have your code flipped. Shouldn't it be?

=only({<InvoicePeriodNumber={'$(=only(InvoicePeriodNumber))'}>}InvoicePeriod)


I have another question as well. What if you can select 2 InvoicePeriods?  How can I then select 2 InvoicePeriodNumbers?

Highlighted
Not applicable

With Concat function and a veriable:

v_InvoicePeriod= replace(chr(39)&concat(InvoicePeriodNumber,',')&chr(39),',',chr(39)&','&chr(39))

and this as expression:

=only({<InvoicePeriodNumber={$(v_InvoicePeriod)}>}InvoicePeriod)

Highlighted
Not applicable

I have tried this solution but am not able to get it to work.

I have two fields - Report_Year and RYear.  The values are identical but they need to remain separate (i.e., not rename one to be the same as the other).

What I need to do is when the user selects a value from the Report_Year list box, set the same value as a filter on RYear.

I've tried the code mentioned above but I can't seem to get it to work.

I've gone to Documents; Triggers and added an OnSelect action to the Report_Year field.  The Action is Select in Field, the Field is RYear and the Search String is =only({<Report_Year={'$(=only(Report_Year)'}>} RYear) - a modified version of what I found above.  However, it does not work.

Can you help a relative newbie?

Thank you.