Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i want to create a unique key in a table so that qlikview automatically joins the tables.
Therefore how do i join 2 fields from 2 different tables in the load script:
MY SCRIPT LOOKS LIKE THE FOLLOWING
---------
TABLE 1
LOAD
FIELD 1,
FIELD 2,
FIELD 3,
FROM data\Table 1.qvd (qvd);
TABLE 2
LOAD
FIELD A,
FIELD B,
FIELD C,
FROM data\Table 2.qvd (qvd);
TABLE 3
LOAD
Key,
[Account Type]
[Transaction Type]
FROM [data\Lookup Table 3.xls];
------------
What i want to do is create a new field in Table 2 called 'Key' and this should be made from a concatenation of Table 1.Field 1 + Table 2.Field B
Regards
Hi,
This is just an example for u . You can replace the Temp1 and Temp2 tablea with your Table1 and Table2. Temp3 is the temporary table. Sorry for the confusion. Heres the code as per your requirement.
There is jus one temporary table Main_temp .
Transactions:
LOAD TRX_ID AS [Transaction ID],
[Transaction Type],
ACC_ID,
FROM
data\TRANSACTIONS.qvd
(qvd);
Accounts:
LOAD
ACC_ID,
LEDTYP_ID,
FROM
data\ACCOUNTS.qvd
(qvd);
Main_Temp:
load
ACC_ID,
[Transaction Type] as TT,
Resident Transactions;
Left Join(Main_Temp)
load ACC_ID,
LEDTYP_ID as LTI
Resident Accounts;
Left Join (Accounts)
Load
ACC_ID,
TT&'.'<I as Key
Resident Main_Temp;
Drop table Main_Temp;
What is a relationship between Table1 and Table2. Or do you want to make cartesian?
i guess cartesian join, i havent defined any joins between table 1 and table 2.
any update on this thread??????
Hi,
TABLE 2
LOAD
FIELD A,
FIELD B,
FIELD C,
FIELD 1& '.' & FIELD B
FROM data\Table 2.qd (qvd);
RESIDENT TABLE 1;
The '.' in
FIELD 1& '.' & FIELD B is a delimiter. You can remove it if you want to.
Normal 0 false false false MicrosoftInternetExplorer4
Hi, this doesnt seem to work as i get the 'Field not found - <Transaction Type> ' error.
Heres the script im using which shows tables 1 and 2. The key field im trying to create is [Transaction Type]& '.' & LEDTYP_ID
--------------------------
Directory;
Transactions:
LOAD TRX_ID AS [Transaction ID],
[Transaction Type],
ACC_ID,
FROM
data\TRANSACTIONS.qvd
(qvd);
LOAD
ACC_ID,
LEDTYP_ID,
[Transaction Type]& '.' & LEDTYP_ID
FROM
data\ACCOUNTS.qvd
(qvd);
RESIDENT TRANSACTIONS;
----------------------------
What do i have to do to get this script to work and make the join field?
hey,
Try this . You have to give an Alias Name to the new feild created. [Transaction Type]& '.' & LEDTYP_ID AS KEY
Transactions:
LOAD TRX_ID AS [Transaction ID],
[Transaction Type],
ACC_ID,
FROM
data\TRANSACTIONS.qvd
(qvd);
LOAD
ACC_ID,
LEDTYP_ID,
[Transaction Type]& '.' & LEDTYP_ID AS KEY
FROM
data\ACCOUNTS.qvd
(qvd);
RESIDENT TRANSACTIONS;
The following errors appear
Field not found - <Transaction Type>
also
Unknown statement
RESIDENT Transactions
Any help on this would be great?
does anyone have any advise on this?
regards
jason