Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Column Header has current year value in it

Hi all,

I have a table that has current year value in it. now that we are at the new year the script failed to load and i need to change the headers names from [Jan 14] to [Jan15] and [Feb 14] to [Feb15] and so on..

Is there any dynamic way to pass Year of today into the header of the columns?

Best,

Alec

6 Replies
jpapador
Partner - Specialist
Partner - Specialist

Can you provide anymore detail?  It is unclear what you are trying to accomplish,  the statement Year(Today()) will return the year of today in both the script and expressions.

alec1982
Specialist II
Specialist II
Author

sure, I have a source table with columns as follow:

Jan 14

Feb 14

Mar 14

and i loaded it into QlikView last year. the table headers have been changed as we entered 2015 to be:

Jan 15

Feb 15

Mar 15

I am looking to make the headers within the script dynamic so i don't face the issue every year..

jpapador
Partner - Specialist
Partner - Specialist

Is there a reason you cannot do a load * in your script instead of specifically naming out the fields from the source table?  It may be helpful if you can post a screen shot or a sample of your load script.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

As jpapador pointed out, it's easy if "LOAD *" work for you. If not, you can form the column names dynamically like this:

LET vYear = Date(today(),'YY');

LOAD

  [Jan $(vYear)],

[Feb $(vYear)],

.. and so on.

-Rob

alec1982
Specialist II
Specialist II
Author

Thank you Rob! This is a right.. for some reason i dont see a button to to click and show as correct answer..

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

HI Alec,

Glad it worked. There is no "correct" answer button because the the original post is not set as a question. Don't know if there is any way to change that now, but in the future watch for that little check box at the top when you create new questions.

-Rob