Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Syncing selection in two date fields using trigger

Hello all, I have two date fields one simply called 'Date' and one called '[TS Date]'. The possible values in Date are the last days of the month for example, 1/31/2017, 2/28/2017, etc. The possible values of the field TS date are the 15th of every month and the last day of the month. What I want to accomplish is that when a date is selected in Date, the corresponding two dates are selected in TS Date. For example if 2/28/2017 is selected in Date, TS Date would have 2/15/2017 and 2/28/2017 selected. I am currently trying to go about this using a trigger on Date field selection. Below is my attempt at getting the trigger to work for just one month, May. I think if I can get that I can expand the solution to cover all of the months.

Action: Select in Field

Field: [TS Date]

Search String: If(SubstringCount(GetFieldSelections(Date), '5/31/2017') > 0, '5/15/2017' & '5/31/2017', 0)

Thanks in advance for the help.


Zach

8 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi Zach,


May be like in attached file with use variable event trigger? Create variable with expression

=GetFieldSelections(Date).

Next in the document properties set the trigger to change the variable (look attached file).


Regards,

Andrey

Not applicable
Author

Would you mind posting a screenshot or the text of the search string or pasting the text? I only have personal edition and cannot open the .qvw. Thanks!

Zach

ahaahaaha
Partner - Master
Partner - Master

I apologize for not answering immediately

1.jpg

2.jpg

3.jpg

Andrey

antoniotiman
Master III
Master III

Hi,

may be this

List Box Field Date

List Box Expression :

=Aggr(Only({<[TS Date]={"=Month([TS Date])=Max(Month(Date))"}>} [TS Date]),[TS Date])

Regards,

Antonio

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Zach,

others above have replied as to how to set up a trigger to achieve this, however I'd suggest a slightly different approach.

Have you thought about modifying your data model to use a single date field and a master calendar? If you did so it would be a fairly simple matter to set up your charts to use set analysis to cover the time period you are interested in.

Marcus

Not applicable
Author

Thank you for the suggestion. That is something I will look into doing.

Zach

Not applicable
Author

Thank you I will get back to everyone with the results!

Not applicable
Author

Thank you! I will let you know which option works out best.