Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

help needed in renaming the field based on the month.

Dear Community,

I want to change the field name based on the Month field.

i have attached the qvw.

in which it contains field names Month_1  to Month_12.

so month_12 means CurrentMonth(Jan).

i need to change the fileld name based on the month.

now we are in January so in place of Month_12 it should display Jan ,and in place of Month_11 it should display Dec like so on.

and once we move to Feb month_12 should show Feb and Month_11 become Jan and so on.

so please some body help me to solve the issue.

so please find the attachments.

thanks,

Mukram.

1 Solution

Accepted Solutions
sbaldwin
Partner - Creator III
Partner - Creator III

try adding this into your script:

let c = today();

for i = 1 to 12

let t = AddMonths('$(c)',-$(i));

let cn = month('$(t)');

trace rename field MONTH_$(i) to $(cn);

rename field MONTH_$(i) to $(cn);

next i

View solution in original post

4 Replies
sbaldwin
Partner - Creator III
Partner - Creator III

try adding this into your script:

let c = today();

for i = 1 to 12

let t = AddMonths('$(c)',-$(i));

let cn = month('$(t)');

trace rename field MONTH_$(i) to $(cn);

rename field MONTH_$(i) to $(cn);

next i

Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

Dear sbaldwin,

Thanks for your help.

i make a small change in a variable

let t = AddMonths('$(c)',+$(i));

than it working as per my requirement.

Thanks again.

Thanks,

Mukram.



Not applicable
Author

Dear Gysbert Wassenaar,

Thanks for your help.

Thanks,

Mukram.