Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding Columns which don't contain values

Dear Community,

I've some rather easy looking question about the script and adding columns.

I've got a monthly export with all aggregated sums per KPI in the columns

So for 3 months until march it looks like this:

--

column A is Department

column B is KPI

column C is 1

column D is 2

column E is 3

--

The number stands for the month and that's exactly my problem. The column is only existing, if it contains values.

I want to upload the table in this format:

--

column A is Department

column B is KPI

column C as Jan

column D as Feb

column E as Mar

This runs pretty well, but the problem occurs if one month is added in the export-file ("4"). I either can't upload it, because i don't have any values (=column doesnt exist) or the alias (e.g. "Apr" for "4") isn't party of the script.

So how do i automatically count the columns which have values and corresponding to that give fixed names to the column, even if it doesn't contain any values?

Thanks in advance,

donuteater

1 Solution

Accepted Solutions
SunilChauhan
Champion II
Champion II

Load this using cross table

column A is Department

column B is KPI

column C is 1

column D is 2

column E is 3

and make the above as

column A is Department

column B is KPI

Month

value

and then add inline script

Load * inline [

Month,Monthname

1,Jan

2,Feb

3,mar

4,Apr

5,may

6,Jun

7,Jul

8,Aug

9,Sep

10,Oct

11,Nov

12,Dec

];

now use MonthName instead of month

hope this help

Sunil Chauhan

View solution in original post

5 Replies
Not applicable
Author

The problem get's crucial, when i'm having a listbox to select the months. Only the months with values occur there. How could i change that?

regards

SunilChauhan
Champion II
Champion II

Load this using cross table

column A is Department

column B is KPI

column C is 1

column D is 2

column E is 3

and make the above as

column A is Department

column B is KPI

Month

value

and then add inline script

Load * inline [

Month,Monthname

1,Jan

2,Feb

3,mar

4,Apr

5,may

6,Jun

7,Jul

8,Aug

9,Sep

10,Oct

11,Nov

12,Dec

];

now use MonthName instead of month

hope this help

Sunil Chauhan
Not applicable
Author

Thank you very much for your suggestion.

As far as i can see that doesn't solve the problem, that columns without values won't be loaded, am I right?

After the load i won't be able to select any months > 3.

Is there any chance to solve this problem?

// in other words: How can i add a empty column, if the column isn't filled yet to make a total of 12 months.

mdmukramali
Specialist III
Specialist III

dear,

u can add empty columns

like

Load * Inline

[

Month,MonthName

1,Jan

2,Feb

3,Mar

4,

5,

6,

7,

8,

9,

10,

11,

12

]

;

is this one your looking for?

SunilChauhan
Champion II
Champion II

have you tried

if value in month is available till 3 then it will show you only three

try once then let me know .

Sunil Chauhan