Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

nico_ilog
Contributor II

Understanding if a LINK exists?

Good Day Qlik Community!

I have a scenario that i'm struggling with?

If i have these 2 Data Sets:

Table 1:

ID     |     Desc     |

1          xxx

2          xxx    

3          xxx

4          xxx

5          xxx

Table 2:

ID     |     Desc     |

2          xxx    

3          xxx

5          xxx

Therefore IDs: 2, 3, 5 will have links.

How can i create a flag, 2 options: Linked and Not Linked?

In the actual scenario a situation of: Invoiced, not invoiced?

Any/all responses will be appreciated.

Nico

Tags (1)
5 Replies
michael_gardner
Contributor III

Re: Understanding if a LINK exists?

Table2Map:

MAPPING LOAD

     ID,

     Desc

FROM Data Source;

Table1:

LOAD

     IF(ISNULL(APPLYMAP('Table2Map',ID,NULL())),'Not Linked','Linked') as _linkFlag

     ID,

     Desc,

FROM Data Source;

Table2 ...etc.

Re: Understanding if a LINK exists?

If you have all values from table 2 contained in table 1 then simply :

MyTabTemp:

load id, desc1 from table1

left join

load id, desc2, '1' as flag  from table2;

Where you find '1' values as flag there is a link ...

Let me know

nico_ilog
Contributor II

Re: Understanding if a LINK exists?

Using the Resident Function?

michael_gardner
Contributor III

Re: Understanding if a LINK exists?

Table1:

Load

     ID,

     Desc

FROM Date Source;   

Left Join

Table 2:

Load

     ID,

     Desc,

     'Linked' as _tempflag

From Data Source;

Load

     ID

     Desc,

     IF(_tempflag='Linked','Linked','Not Linked') as _flag

Resident Table1;

nico_ilog
Contributor II

Re: Understanding if a LINK exists?

Perfect!

Changed it up a bit! But works like a charm!

Thumbs up!

Michael Gardner wrote:

Table1:

Load

     ID,

     Desc

FROM Date Source;  

Left Join

Table 2:

Load

     ID,

     Desc,

     'Linked' as _tempflag

From Data Source;

Load

     ID

     Desc,

     IF(_tempflag='Linked','Linked','Not Linked') as _flag

Resident Table1;

Community Browser