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: 
Not applicable

Adding 'Start date' and 'End date' to the calendar dynamically

Hi All,

I have a small problem regarding calendar. I have the following fields in the 'Time' table.

Capture_qlikview1.PNG

I have to add two new columns to the this table in the qlikview script.

They are 'start date' and 'end date'.

'start date' should be the April 1 of the current year and 'end date' should be March 31 of the next year.

eg:

for the column with year key=10 start date='1-April-2010' and end date='31-March-2011'.

We should not hard code for each column,

Please suggest how we can modify the script to get the desired output.

Thanks,

Surendra

1 Solution

Accepted Solutions
Not applicable
Author

Another try... If that is not what you're looking for, perhaps some of the others can try to help 😛

- Find the attached qvw

- note that when the variable vTestDateToday is set to a new (test)value AND you switch between sheet1 and Main... the (as far as I understand your problem correctly) right selection is set...

- The reason is that I defined (at sheet level) a trigger to do the selection and applied some setAnalysis to figure out which year to take

So what I wonder is:

[1] does it pick the right year for every inputdate that you test with? (if not, what is my misunderstanding)

[2] does this fix your problem?

Hope it helps 🙂

View solution in original post

11 Replies
Not applicable
Author

Pls Can any one respond!!

It's a bit urgent!!!

Thanks,

Surendra

Not applicable
Author

Is this what you're looking for?

load *,

MakeDate((2000+[Year Key]),4,1) as StartDate,

MakeDate(2001+[Year Key],3,31) as EndDate

Inline

[

Year Key,Calendar Year,Year

10,2010,F11

11,2011,F12

12,2012,F13

13,2013,F14

];

Not applicable
Author

as Roberto Postma suggest you or

MakeDate([Calendar Year],4,1) as StartDate,

MakeDate(([Calendar Year]+1),4,1)as EndDate

Not applicable
Author

Thanks a lot Roberto and Mohammed Own for your help.

Sorry for extending this discussion. I have an issue regarding this.

I have to display a default Year. The default Year is displayed in such a way that today's date is checked to find out under which start date and end date it falls and that year is displayed as default Year.

eg: Today's date is 18/06/2012 and it falls between the range 01/04/2012 to 31/03/2013. Hence the default year to be displayed is F13.

Can you help me regarding the same.

Not applicable
Author

Hi Surenda-m,

How do you have to display that?

You mean in a chart or something?

Could you post a sample-qvw with an indication where your problem lies? Then lets see how I can help...

For me it is now unclear if your issue is still in the load-script, or if you want to have some "initial selection" based on the current year; I hope you can elaborate a bit.

Not applicable
Author

Hi Roberto,

I have to display the default year value in a list box. I feel it can be done in the front end.

I am unable to find the upload of qvw option in the discussion page.

Thanks,

Surendra

Not applicable
Author

I think this should be helpful for you then. Could you let me know if that helped?

http://community.qlik.com/thread/27836

Not applicable
Author

No Roberto. That's not what I was looking for.

Let's consider this example.

Today's date is 18/06/2012 . The default Year that is to be displayed is F13.

If today's date is 01/01/2013 then the default Year that is to be displayed is F13.

I think we have to check under which start date and end date range today's date falls under and we have to display the Year(Financial) accordingly.

Thanks,

Surendra

Not applicable
Author

Another try... If that is not what you're looking for, perhaps some of the others can try to help 😛

- Find the attached qvw

- note that when the variable vTestDateToday is set to a new (test)value AND you switch between sheet1 and Main... the (as far as I understand your problem correctly) right selection is set...

- The reason is that I defined (at sheet level) a trigger to do the selection and applied some setAnalysis to figure out which year to take

So what I wonder is:

[1] does it pick the right year for every inputdate that you test with? (if not, what is my misunderstanding)

[2] does this fix your problem?

Hope it helps 🙂