Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
jonathandienst
Partner - Champion III
Partner - Champion III

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

View solution in original post

3 Replies
crusader_
Partner - Specialist
Partner - Specialist

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

jonathandienst
Partner - Champion III
Partner - Champion III

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
Author

Thanks a lot