Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
fredericvillemi
Creator III
Creator III

How to mix data from different sources in Script ?

Hi,

this is a pretty simple but i can't manage to do that

I have a script in which i have two queries

firstone:

LOAD myid,

firstdate,

mytype;

SQL select myid, firstdate,mytype;

secondone:

LOAD myid,

seconddate,

otherinformation;

SQL select myid, seconddate,otherinformation;

I want to create an object like that :

if(mytype='FIRSTTYPE',firstdate,seconddate)

I think you have understood !  

I can do that in an expression or variable but i would like to pre-calculate that during the Script Reload

to be able to have a "virtual" table with myid and the result of my calculation

Is it possible ? and how ?

Thanks

1 Solution

Accepted Solutions
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi,

You can first join two tables on Primary key so that both dates should be in same table and then in next resident load create newdate by using if condition:

T1:

Load

MyId,

Firstdate,

...

From A

Left Join

Load

MyId,

SecondDate

From B;

T2:

Load

*,

If(MyType='ABC',ForstDate,SecondDate)

Resident T1;

Drop Table T1;

View solution in original post

3 Replies
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi,

You can first join two tables on Primary key so that both dates should be in same table and then in next resident load create newdate by using if condition:

T1:

Load

MyId,

Firstdate,

...

From A

Left Join

Load

MyId,

SecondDate

From B;

T2:

Load

*,

If(MyType='ABC',ForstDate,SecondDate)

Resident T1;

Drop Table T1;

Not applicable

When you load your second table instead of creating a second table, join it to the first table

left join (firstone)

LOAD myid, seconddate, otherinformation SQL...

Now that you have both in the same row, you can do this

left join (firstone)

LOAD myid,

     If(mtype='FIRSTTYPE', firstdate, seconddate) as FinalValue

resident firstone;

that work for you?

Not applicable

Hi Frederic,

You can join those two tables and create a single table by using left, right or full join keywords in QlikView.

I create a sample using full outer join function. It is same as SQL logic.

Then I call the logical table that i create with resident function..

I hope it helps you.

BR

Omer