Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

update table already load from file

Hello guys,

I have a table that I want to upgrade one of its fields here (COST) :

COST:

load * inline[

ID,COST YEAR

2,20,2014

23,0,2015

];

I have a file that contains the 2016 data , my question is how can i load the table , saying if COST is 0 take COST from file .


field in file:

ID,COST YEAR

23,10,2015

1 Solution

Accepted Solutions
MVP
MVP

Re: update table already load from file

Perhaps something like this:

// Current File

COST:

load * inline

[

ID, COST, YEAR

2,20,2014

23,0,2015

];

//2016 File

Join(COST)

load * inline[

ID, COST As COST1, YEAR

[

23,10,2015

];

// Combine

Result:

Noconcatenate

LOAD ID,

  YEAR,

  If(COST = 0 Or IsNull(COST), COST1, COST) As COST

Resident COST;

DROP Table COST:

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
3 Replies
crusader_
Valued Contributor

Re: update table already load from file

Hi,

1. You need to load both tables into your datamodel. If you load tables in a row they will autoconcatenated (union);

2. Perform resident load from Result table and exclude unnecessary rows using where clause and peek() or previous() functions.

Hope this sheds lights to the solution.

Regards,

Andrei

MVP
MVP

Re: update table already load from file

Perhaps something like this:

// Current File

COST:

load * inline

[

ID, COST, YEAR

2,20,2014

23,0,2015

];

//2016 File

Join(COST)

load * inline[

ID, COST As COST1, YEAR

[

23,10,2015

];

// Combine

Result:

Noconcatenate

LOAD ID,

  YEAR,

  If(COST = 0 Or IsNull(COST), COST1, COST) As COST

Resident COST;

DROP Table COST:

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

Re: update table already load from file

Thanks a lot

Community Browser