Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner - Specialist III
Partner - Specialist III

Relationship between two tables

Hi,

I've a different number of fields from  qvd file. Along this fields i'm creating new fields with calculation. Again i'm using the newly create fields in resident load and based on the calculation of this fields again creating new fields. But, now i want to see exact result in the table box . How can i combine this fields in proper manner.

For Eg:

Table1:


Load A,

          B,

          if(C<>23,C) as C1

From Table1.qvd;

Table2:


Load

     if(Len(C1)>0,C1) as C2

Resident Table1;

- Now, when i load A,B,C1 in one table box. I can see exact data what i retrived from qvd file.

- But if i load A,B,C1,C2 in table box then i want to see exact data how it is loaded(i.e 1 by 1 loading Table1.qvd) qvd file.

- With what keyword i can make relationship to this tables.

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

You can do that in only one table, do you really need two tables for that? Check the following script

Table1:

LOAD A,

     B,

     If(C <> 23, C) as C1,

     If(Len(If(C <> 23, C)) > 0, If(C <> 23, C)) AS C2 // replacing the equivalent to C1 used in the field above

From Table1.qvd;

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

View solution in original post

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    You can try this.

   

Table1:


Load A,

          B,

          if(C<>23,C) as C1

From Table1.qvd;

Table2:


Load

     A,

     if(Len(C1)>0,C1) as C2

Resident Table1;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
SunilChauhan
Champion II
Champion II

Hi,

    You can try this.

   

Table1:


Load A,

          B,

          if(C<>23,C) as C1

From Table1.qvd;

left join(Table1)


Load

     A,

     if(Len(C1)>0,C1) as C2

Resident Table1;

this will give u fast access even in complx scenario

Sunil Chauhan
Miguel_Angel_Baeyens

Hi,

You can do that in only one table, do you really need two tables for that? Check the following script

Table1:

LOAD A,

     B,

     If(C <> 23, C) as C1,

     If(Len(If(C <> 23, C)) > 0, If(C <> 23, C)) AS C2 // replacing the equivalent to C1 used in the field above

From Table1.qvd;

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Thanks a lot for all....

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Miguel,

In if loop why we need to check conditon again. we can write like this also know.

Table1:
LOAD A,
     B,
     If(C <> 23, C) as C1,
     If(Len(If(C <> 23, C)) > 0, C) AS C2 // replacing the equivalent to C1 used in the field above
From Table1.qvd;

Miguel_Angel_Baeyens

Yes, that will be cleaner. Say the value for field C in the current record is "4". C1 is equal to 4, and C2 qwill be equal to 4 as well, because Len(4) > 0 returns true. Say now that the value is "23". C1 is equal to null() (there is no "else" part in the If() condition). C2 will be null as well, because it will enter the "else" part of the if, and since there is nothing specified, null() is returned.

Hope that makes sense.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hello,

ya what you said is correct. There is no else part so it returns null in both cases(c1,c2).


Thanks buddy..