Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

Re: Adding an additional column via Script

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.

10 Replies
mwoolf
Honored Contributor II

Adding an additional column via Script

Use a preceeding load.

Add this just above the Excel load:

load

     *,

     'IST' as Datatype;

Not applicable

Re: Adding an additional column via Script

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$);

mwoolf
Honored Contributor II

Re: Adding an additional column via Script

Try it just above the crosstable function

Not applicable

Re: Adding an additional column via Script

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.

mwoolf
Honored Contributor II

Re: Adding an additional column via Script

Try this AFTER your load:

load

     *,

     'IST' as Datatype

resident YourExcelTableName;

Not applicable

Adding an additional column via Script

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

Not applicable

Re: Adding an additional column via Script

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

Adding an additional column via Script

Thank you so much!

I finally got it. :-)

farolito20
New Contributor III

Re: Adding an additional column via Script

How you could add column?