Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Extract from the same field the values coming from two source files

Hello everyone,

I have uploaded the same field "Product" from 2 different file: the 1st with all the products and the 2nd with just some of them.

  Now I'd like to have a table that shows just the product coming from the second file so the user can immediately select these products.

Any ideas??

Thanks!!

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I would add a source field, like this:

     Data:

     LOAD Product,

          'File1' As Source

     FROM File1;

     Concatenate (Data)

     LOAD Product,

          'File2' As Source

     FROM File2;

Now just use Source as a filter.

HTH

Jonathan

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

View solution in original post

6 Replies
PrashantSangle

Hi,

Rename that field and then use that field as filter

Try like

table2:

Load

Product as NewProduct,

Product //Use this if required for creating association else comment it.

from tableNAme;

From above script use NewProduct as filter

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I would add a source field, like this:

     Data:

     LOAD Product,

          'File1' As Source

     FROM File1;

     Concatenate (Data)

     LOAD Product,

          'File2' As Source

     FROM File2;

Now just use Source as a filter.

HTH

Jonathan

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

Hi, I think your best option is to create a field to mark these products when you are loading them I'll need a sample script to be more specific but maybe could be one these options:

- Loading all products and mark those which exists in file 2

ProductTable:

LOAD IdProduct,...

FROM file1;

Concatenate

LOAD IdProduct,...

FROM file2;

Left Join (ProductTable)

LOAD IdProduct, '1' as _IsFromFile2

FROM file2;

- Load products from file2 marked and then load products from file1 wich not exists in file2

ProductTable:

LOAD IdProduct, '1' as _IsFromFile2,...

FROM file2;

Concatenate

LOAD IdProduct, '0' as _IsFromFile2,...

FROM file1 where not exist('IdProduct', IdProduct);

salto
Specialist II
Specialist II

Hi Jonathan,

I might be wrong but, how can you select Products from the second table only, with your load script ?

Thanks!

PrashantSangle

Hi,

Nice one. I really like this logic and thanks for teaching this different way to develop script.

Thanks again.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Thanks, Jonathan solution works fine then I made a table with Source='file2' in the expression.