Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
AH
Creator III
Creator III

Dynamic windows title with Date variables and Date fields

Hi,

I have a table thats Title should change based on the selections of date. And I have DatePicker Calendar objects that is based on two variables  vStart_Date  & vEnd_Date. So I am using them in the table title(Below mentioned expression) to get the date range whenever the user is selecting a date range in the datePicker Calendar. But I have Invoice Year and Invoice Month list box as well so that the users could select them whenever they want to.

The Problem is, when they select Invoice Year or Invoice Month the Date range from the table title doesn't go away. It stays in the title even the if i select only Year say, 2015 or month January.

='Report  '   &'('&''& vStart_Date  & ' - ' & vEnd_Date&')'

Is there any logic i can add to the mentioned expression here to achieve to that point?

I would appreciate your help.

Thanks,

Ahmed

20 Replies
sunny_talwar

Try this:

='Report  ' &

If(GetSelectedCount([Invoice Year]) > 1,

If(GetSelectedCount([Invoice Month]) > 1, Concat([Invoice Month], ', ') & ' ' & Concat([Invoice Year], ', '), Concat([Invoice Year], ', ')),

If(GetSelectedCount([Invoice Month]) > 1, Concat([Invoice Month], ', '), '(' & vStart_Date  & ' - ' & vEnd_Date & ')'))

If you select 2014 and 2015 -> Output: Report 2014, 2015

If you select Jan and Feb -> Output: Report Jan, Feb

If you select 2014 and 2015 and Jan and Feb -> Output: Report Jan, Feb 2014, 2015

Not sure if the formatting is something you would like, but I don't know what your user will be selecting and what formatting would be ideal for them to see.

I hope this make sense?

Best,

Sunny

AH
Creator III
Creator III
Author

Hi Sunny,

For some reason

The expression from your last comment is not working for the Year/ Month selections.

Thanks,

Ahmed

avinashelite

try like this:

Insted of concat use the getfieldselections() function it should work

'Report  ' &

If(GetSelectedCount([Invoice Year]) > 1,

If(GetSelectedCount([Invoice Month]) > 1, getfieldselections([Invoice Month], ', ') & ' ' & getfieldselections([Invoice Year], ', '), getfieldselections([Invoice Year], ', ')),

If(GetSelectedCount([Invoice Month]) > 1, getfieldselections([Invoice Month], ', '), '(' & vStart_Date  & ' - ' & vEnd_Date & ')'))

AH
Creator III
Creator III
Author

Hi Avinash,

I tried with the expression you mentioned here but if i select Invoice Year list box it doesnot show anything.

The expression Sunny T. provided in his earlier post works most part but the months selection & Multiple years and Months & Years combined doesnt work with that expression.

Here is Sunny T's expression:

='Report  ' &

If(GetSelectedCount([Invoice Year]) = 1,

If(GetSelectedCount([Invoice Month]) = 1, [Invoice Month] & ' ' & [Invoice Year], [Invoice Year]),

If(GetSelectedCount([Invoice Month]) = 1, [Invoice Month],  '(' & vStart_Date  & ' - ' & vEnd_Date & ')'))

Thanks,

Ahmed

AH
Creator III
Creator III
Author

Hi Avinash,

One correction: Its working only for Multiple years selection. But not single years or months.

Thanks,

Ahmed

avinashelite

can you please share your app??

sunny_talwar

Try this may be:

='Report  ' &

If(GetSelectedCount([Invoice Year]) >= 1 and GetSelectedCount([Invoice Month]) >= 1, GetFieldSelections([Invoice Month]) & ' ' & GetFieldSelections([Invoice Year]),

If(GetSelectedCount([Invoice Year]) >= 1 and GetSelectedCount([Invoice Month]) = 0, GetFieldSelections([Invoice Year]),

If(GetSelectedCount([Invoice Year]) = 0 and GetSelectedCount([Invoice Month]) >= 1, GetFieldSelections([Invoice Month]),

If(GetSelectedCount([Invoice Year]) = 0 and GetSelectedCount([Invoice Month]) = 0, '(' & vStart_Date  & ' - ' & vEnd_Date & ')'))))

sunny_talwar

That was my mistake, instead of >1 you need >=1

AH
Creator III
Creator III
Author

Hi Sunny,

Thanks for the great help. I just cant thank you enough!

Year/Multiple Years both are working now. Only the months are not picking up. Except that everything is working.

Thanks,

Ahmed

sunny_talwar

‌Have you checked the Month field... May be I am calling it incorrectly ([Invoice Month]). May be in your database its called something else or the case is the issue? Not really sure what the issue is with month.