Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
rdsuperlike
Creator
Creator

lookup

Hi,

If i want to do a lookup on the primary key in another table and if the value is matching I want to display flag = 1 or flag =0.

Can someone help me how to do this.

Updated the post with an example. But lookup doesnt seem to work here...can someone help me whats wrong in it?

Thanks

1 Solution

Accepted Solutions
maxgro
MVP
MVP

in script?

// test tables t1 t2

t1:

load * inline [

field1, field11

a,1

b,2

c,3

];

t2:

load * inline [

field1, field22

a,1

c,3

d,4

];

// calc flag

map: Mapping LOAD field1, 1 Resident t1;

left join (t2)

load field1, ApplyMap('map', field1, 0) as flag

Resident t2;

View solution in original post

6 Replies
sasiparupudi1
Master III
Master III

Please Provide sample application and requirements in detail

maxgro
MVP
MVP

in script?

// test tables t1 t2

t1:

load * inline [

field1, field11

a,1

b,2

c,3

];

t2:

load * inline [

field1, field22

a,1

c,3

d,4

];

// calc flag

map: Mapping LOAD field1, 1 Resident t1;

left join (t2)

load field1, ApplyMap('map', field1, 0) as flag

Resident t2;

rdsuperlike
Creator
Creator
Author

yes.in the script.

I want to do the other way. want to see flag values in t1.

rdsuperlike
Creator
Creator
Author

posted

maxgro
MVP
MVP

if you want the flag in t1

t1:

load * inline [

field1, field11

a,1

b,2

c,3

];

t2:

load * inline [

field1, field22

a,1

c,3

d,4

];

map: Mapping LOAD field1, 1 Resident t2;

left join (t1)

load field1, ApplyMap('map', field1, 0) as flag

Resident t1;

rdsuperlike
Creator
Creator
Author

My tables t1 and t2 are really huge.

due to the left join, its creating duplicate records in the qvds that I am storing t1 and t2 into .

If i chnage it to left keep the qvd shows unique records and is proper..but it generates map table in the model which is not required.

If i use Drop table map;

at the end after using keep, it drops flag field....any solution here?

1:

load * inline [

field1, field11

a,1

b,2

c,3

];

t2:

load * inline [

field1, field22

a,1

c,3

d,4

];

map: Mapping LOAD field1, 1 Resident t2;

left keep (t1)

load field1, ApplyMap('map', field1, 0) as flag

Resident t1;