Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

yura_ratu
Contributor II

Upload new data and replace old one

Hi all,

I load new data every day and need not just concatenate it to previous one, but also make changes in old data according to a new data. Here is an example of tables

load * Inline [

a, b

1,2

2,3

3,8

];

load * Inline [

a, b

1,5

2,3

4,3

5,4

];

As a result of joining/concatenating them I would like to have

a, b

1,5

2,3

3,8

4,3

5,4

How can I do that?

Tags (1)
1 Solution

Accepted Solutions
nagaiank
Valued Contributor III

Re: Upload new data and replace old one

Try loading in the following order:

load * Inline [

a, b

1,5

2,3

4,3

5,4

];

Concatenate

load * Inline [

a, b

1,2

2,3

3,8

]

where not exists(a);

9 Replies

Re: Upload new data and replace old one

Here it is:

A:

NoConcatenate

load * Inline [

a, b

1,2

2,3

3,8

];

B:

NoConcatenate

load * Inline [

a, b

1,5

2,3

4,3

5,4

];

AB:

NoConcatenate

LOAD * Resident A;

Concatenate

LOAD * Resident B;

DROP Tables A, B;

Left Join

LOAD a, Max(b) as M Resident AB Group by a;

Final:

NoConcatenate

LOAD * Resident AB Where M = b;

DROP Table AB;

Not applicable

Re: Upload new data and replace old one

Can you try this

A:

load * Inline [

a, b

1,2

2,3

3,8

];

Concatenate

B:

load * Inline [

a, b

1,5

2,3

4,3

5,4

];

NoConcatenate

AB:

load distinct a, b

Resident A;

drop table A;

yura_ratu
Contributor II

Re: Upload new data and replace old one

Thanks Alessandro!

But what if values are not numbers, or number which become both less or more. In final table should be value from second load, not matter what there

yura_ratu
Contributor II

Re: Upload new data and replace old one

Result will be

1,2

1,5

2,3

3,8

4,3

5,4

nagaiank
Valued Contributor III

Re: Upload new data and replace old one

Try loading in the following order:

load * Inline [

a, b

1,5

2,3

4,3

5,4

];

Concatenate

load * Inline [

a, b

1,2

2,3

3,8

]

where not exists(a);

Not applicable

Re: Upload new data and replace old one

You mean the result should be Ordered??

Not applicable

Re: Re: Upload new data and replace old one

I get exactly the way you asked for the code snippet post my me earlier. Plz. see the screen shot.

yura_ratu
Contributor II

Re: Upload new data and replace old one

I meant that should be unique "a" values, and "b" values from the latest load

yura_ratu
Contributor II

Re: Upload new data and replace old one

It works! Thank you.

Could you please explain how this "where not exists(a)" statement works here?

Community Browser