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

Announcements
Save an extra $150 Dec 1–7 with code CYBERWEEK - stackable with early bird savings: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create conditions from information in the fieldname

Hej everyone

I am compiling an Excel-sheet with a large number of columns. Clusters of columns have the month number as part of the column name.

M01 corresponds to January, M02 to February etc

I would like to make a field called Month and set all fields that contain M01 to January etc.

Haven't figured out how to do this.

Anyone?

BR

Example:

 

[CoGS (Loc) M01],
[CoGS (SEK) M01],
[CoGS (Loc) M02],
[CoGS (SEK) M02],
[CoGS (Loc) M03],
[CoGS (SEK) M03],
[Transfer Price (Loc) M01],
[Transfer Price (SEK) M01],
[Transfer Price (Loc) M02],
[Transfer Price (SEK) M02],
[Transfer Price (Loc) M03],
[Transfer Price (SEK) M03],
[Net Sales (Loc) M01],
[Net Sales (SEK) M01],
[Net Sales (Loc) M02],
[Net Sales (SEK) M02],
[Net Sales (Loc) M03],
[Net Sales (SEK) M03],

4 Replies
Not applicable
Author

Hi,

you can use in your script something like this:

if(WildMatch(Field,'*M01') = 1, 'Jan', if(WildMatch(Field,'*M02') = 1,'Feb')) as Month

If you want there is "switch case" statement

hope it helps

regards

Giampiero

Not applicable
Author

Thanks for the reply.

But I think that WildMatch only compares values IN the field. I need something that checks the name of the field.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can create a field mapping table and use that to change field names. See this blog post. If you want you can use a mapping table and the mapsubstring() function to help create the field mapping table.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you so much for your reply. However I am not very familiar with the mapping functions. I'll try!