Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
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
Honored Contributor

Re: Syncing selection in two date fields using trigger

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

Re: Syncing selection in two date fields using trigger

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
Honored Contributor

Re: Syncing selection in two date fields using trigger

I apologize for not answering immediately

1.jpg

2.jpg

3.jpg

Andrey

antoniotiman
Honored Contributor III

Re: Syncing selection in two date fields using trigger

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
Valued Contributor III

Re: Syncing selection in two date fields using trigger

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

Re: Syncing selection in two date fields using trigger

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

Zach

Not applicable

Re: Syncing selection in two date fields using trigger

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

Not applicable

Re: Syncing selection in two date fields using trigger

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