Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
posywang
Creator II
Creator II

How to change values when two tables joined?

Hi,

I have two tables and the 2nd table left join the first one. My question is how to change value in Quality based on value in Product?

For example, if Product name starts with "C", change value of Quality to "Bad". Please let me know. Thanks.

   

Table A
Prod IDProductType
1AppleFruit
2BananaFruit
3BikeVehicle
4CarVehicle
5CatAnimal

   

Table B
TypeSourceQuality
FruitUSAAmazing
VehicleChina

Great

AnimalMexicoAwesome
Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Maybe use a MAPPING approach:

Don't join - use Applymap instead

MAP:

MAPPING

LOAD Type, Source & '|' & Quality

FROM TableB;

LOAD

[PROD ID], Product, Type,

     If(Left(Product), 'C', 'Bad', SubField(ApplyMap('MAP', Type),'|',2) ) as Quality,

    SubField(ApplyMap('MAP', Type),'|',1) ) as Source

FROM TABLEA;

View solution in original post

2 Replies
swuehl
Champion III
Champion III

Maybe use a MAPPING approach:

Don't join - use Applymap instead

MAP:

MAPPING

LOAD Type, Source & '|' & Quality

FROM TableB;

LOAD

[PROD ID], Product, Type,

     If(Left(Product), 'C', 'Bad', SubField(ApplyMap('MAP', Type),'|',2) ) as Quality,

    SubField(ApplyMap('MAP', Type),'|',1) ) as Source

FROM TABLEA;

posywang
Creator II
Creator II
Author

I added null() to formula since I do have some blank data but otherwise the solution is perfect! Thanks!