Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

AH
Contributor

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

1 Solution

Accepted Solutions

Re: Dynamic windows title with Date variables and Date fields

‌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.

20 Replies

Re: Dynamic windows title with Date variables and Date fields

It is doable, but what would you want to see if you:

1) select Invoice Year?

2) select Invoice Month?

Listing out all possibilities would help us determine what would be the best if statement that would help you achieve whatever you final goal is.

Hope that make sense.

Best,

Sunny

AH
Contributor

Re: Dynamic windows title with Date variables and Date fields

Hi Sunny,

Thanks for your quick response. If i select Invoice Year I would like to see only Invoice Year in the title.

For example , Report 2015 (if i select Invoice Year 2015) in the Title. Same goes for Invoice Month.

Again, If i select Year 2015 and Month January (As Invoice Month) i would like to see Report January 2015 in the title.

In this case the date Range(which is based on the variables) should not be displayed.

But when i select date range then only i would like to see the date range in the Title.

Like, Report (7/12/2015 - 5/11/2015) something like this.

Thanks,

Ahmed

Re: Dynamic windows title with Date variables and Date fields

Got it, and what about the possibility of selecting multiple years and Multiple months? What would be the expected output in those cases? or that won't ever happen?

Re: Dynamic windows title with Date variables and Date fields

Try this if not possibility of multiple selection in year or month:

='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 & ')'))

AH
Contributor

Re: Dynamic windows title with Date variables and Date fields

Hi Sunny,

I know i am being a little greedy here! But it would be very helpful if it shows in the title if i select multiple Years and months.

Thanks a bunch! I really appreciate your responses.

Ahmed

Re: Dynamic windows title with Date variables and Date fields

Try this May be:

='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
Contributor

Re: Dynamic windows title with Date variables and Date fields

Hi Sunny,

For some reason the expression is showing error when i copied that to Table window title.

Thanks,

Ahmed

Re: Dynamic windows title with Date variables and Date fields

My bad try this:

='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 & ')'))

AH
Contributor

Re: Dynamic windows title with Date variables and Date fields

Hi Sunny,

The expression is working now. When I select Invoice Year it shows the Invoice Year But when I select Invoice Year and Invoice Month together it doesn't show the Invoice Year and Invoice Month Together. Also if I select Multiple Years it Doesn't Show Multiple Invoice Years in the title.

Thanks for All your effort. Whatever i got still very helpful.

Thanks,

Ahmed

Community Browser