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

Query to change value of feilds based on anathor

I have a 2 tables,

Table1:

Load * inline [

Id,remark

1,abc1

2,def1

3,efg1

];

Table2:

Load * inline [

Id,remark,otherFeilds

1,abc,xyz

2,def,mno

3,efg,pmo

4,ghi,ter

5,ijk,zxy

];

I need to change value of remark feild in Table2 while loading according to the values in Table1. Other values remain same.

My final result would be like..

Id,remark,otherFeilds

1,abc1,xyz

2,def1,mno

3,efg1,pmo

4,ghi,ter

5,ijk,zxy

Could someone suggest me a suitable way?

1 Solution

Accepted Solutions
sunny_talwar

If you are not using an Inline load, then yes

Table1:

Mapping

LOAD * INLINE [

    Id, remark

    1, abc1

    2, def1

    3, efg1

];

Table2:

LOAD Id,

     ApplyMap('Table1', Id, remark) as remark,

     otherFeilds

FROM someQVD.qvd (qvd);

View solution in original post

6 Replies
sunny_talwar

Try this

Table1:

Mapping

LOAD * INLINE [

    Id, remark

    1, abc1

    2, def1

    3, efg1

];

Table2:

LOAD Id,

ApplyMap('Table1', Id, remark) as remark,

otherFeilds;

LOAD * INLINE [

    Id, remark, otherFeilds

    1, abc, xyz

    2, def, mno

    3, efg, pmo

    4, ghi, ter

    5, ijk, zxy

];

bramkn
Partner - Specialist
Partner - Specialist

applymap with a default beeing what the value in table2 is?

jwjackso
Specialist III
Specialist III

Depending on how many records are in table 1, a mapping table would work:

Table1:

Mapping

Load * inline [

Id,remark

1,abc1

2,def1

3,efg1

];

Table2:

load Id,

        Applymap('Table1',Id,remark) as remark,

        otherFeilds;

Load * inline [

Id,remark,otherFeilds

1,abc,xyz

2,def,mno

3,efg,pmo

4,ghi,ter

5,ijk,zxy

];

sujit_nath
Creator III
Creator III
Author

Thanks for your response, but is there a way to achieve the result without using preceeding load?

sunny_talwar

If you are not using an Inline load, then yes

Table1:

Mapping

LOAD * INLINE [

    Id, remark

    1, abc1

    2, def1

    3, efg1

];

Table2:

LOAD Id,

     ApplyMap('Table1', Id, remark) as remark,

     otherFeilds

FROM someQVD.qvd (qvd);

sujit_nath
Creator III
Creator III
Author

Thank you all for your response. The solution proposed worked for me!!