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 an additional column via Script

Dear Community,

again i am confronted with a problem i'm not able to solve.

I'm exporting a number of figures from a Excel-File with the following columns:

--

Year

Month

Cost Center

Value

--

The corresponding Load-Script looks basically like this:

--

directory

load

     Year,

     Month,

     Cost Center,

     Value

from ...

--

My question is, how can i add one more column to the load, which has always the same value?

The "artificial" Table should look like this:

Datatype

Year

Month

Cost Center

Value

Datatype is a constant value: "IST"

Thanks in advance and kind regards,

donuteater

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

mWoolf's script is very easy to implement. Please refer to the attached file for a working example of the same.

Hope that helps.

Regards,

-Shahbaaz.

View solution in original post

11 Replies
m_woolf
Master II
Master II

Use a preceeding load.

Add this just above the Excel load:

load

     *,

     'IST' as Datatype;

Not applicable
Author

Where exactly?

Directory;

crosstable(Month, Wert, 2)

LOAD DEPARTMENT,

     MONTH as KPI,

    [1] as Jan,

    [2] as Feb,

    [3] as Mar,

    [4] as Apr,

    [5] as May,

    [6] as Jun,

    [7] as Jul,

    [8] as Aug,

    [9] as Sep,

    [10] as Oct,

    [11] as Nov,

    [12] as Dec

FROM [Test.xls] (biff, embedded labels, table is Sheet1$);

m_woolf
Master II
Master II

Try it just above the crosstable function

Not applicable
Author

I'm sorry, but then the crosstable function doesn't seem to work properly. After the execution of the script i can only select every month individually by it's name and not via the Month-Dimension.

Furthermore all the KPIs are gone.

m_woolf
Master II
Master II

Try this AFTER your load:

load

     *,

     'IST' as Datatype

resident YourExcelTableName;

Not applicable
Author

I'm sorry, but i don't understand the syntax and where it should be inserted. Sorry, i'm a total beginner.

Not applicable
Author

Hi,

mWoolf's script is very easy to implement. Please refer to the attached file for a working example of the same.

Hope that helps.

Regards,

-Shahbaaz.

Not applicable
Author

Thank you so much!

I finally got it. 🙂

farolito20
Contributor III
Contributor III

How you could add column?