Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Load table Where Exist ($(Variable that may be empty))

Hello,

I am working in a Foor loop where i have to chech for duplicates and I want to do it with an Exist. Comparing the Field of the New Table with the one of the Old Table. The point is that sometimes for some tables i have to do it for 1 field but sometimes for more.

My load is the Folowing

Table:

Load *

Resident MyResidenTable

where not( Exist ( $(Field1NewTable), $(Field1OldTable) ) ) 

and not( Exist ( $(Field2NewTable), $(Field2OldTable) ) ) ;


The problem appears that when $(Field2NewTable) and $(Field2OldTableare empty I can not do the load.

I Tryed Qlikview Loads the table if I do something like not( Exist ( 'RandomText', 'RandomText') ) . But if I use '$(Field1NewTable)'  it is text and when the Fields are not empty does not work Correctly.


Also I tryed to do if( len($(Field2NewTable))>0, $(Field2NewTable), 'RandomText') but QlikView is Still Complaining.


Is there some way to do that?


12 Replies
Miguel_Angel_Baeyens

Actually according to this example, you don't need the loop at all to get the expected result:

Table1:

// LOAD statement for Table1

CONCATENATE LOAD *

FROM Table1.qvd (qvd); // or whatever the name it is for the Table1 concatenation

Table2:

// LOAD statement for Table2

CONCATENATE LOAD *

FROM Table2.qvd (qvd); // or whatever the name it is for the Table2 concatenation

Anonymous
Not applicable
Author

When I add a new one QV is showing it to me in red, I counted them and all are closed, finally I tryed it and I got the same error.

I think that is because what it gets is Alt ( ,0).

Anonymous
Not applicable
Author

You Are Right  and I solved filling the table of the variable names with 0. If i do this, then i can use the Alt() function like

Exists( Alt($(vField2Name),'1'), Alt($(vField2Name),'1') )  and it works

Tables:

Load *

Inline [

TableName,Field1Name,Field2Name

Table1, SomeKeyName1,0,0

Table2,SomeKeyName2,SomeKeyName3

];


I would like both to give to both of you mbaeyens‌ and pradosh_thakur the correct answer but I can't.