Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I'm trying to create a load script where I load data from two different connections. That in it self works if I load them into seperate tables, I can have them in two different tables.
But if I try to load it into one table using left join (keeping the first table, and then adding the extra data into new fields on it) I get an error I'm too green to understand.
Load script:
LIB CONNECT TO 'CDW_Prod';
[Time]:
LOAD PunchScheduleId,
EmployeeId,
RegisteredTimeId,
PunchServiceDeliveryAreaId,
PunchProfitCenter,
PunchAgreement,
PunchInTimeDate,
PunchOutTimeDate,
HoursWorked,
CoorCompany,
Country,
Trim(left(Trim(mid([EmployeeId], 3 + 1)), 6)) AS [empno],
Trim(left(Trim(mid([PunchProfitCenter], 3 + 1)), 4)) AS [PunchProfitCenter2];
SQL SELECT PunchScheduleId,
EmployeeId,
RegisteredTimeId,
PunchServiceDeliveryAreaId,
PunchProfitCenter,
PunchAgreement,
PunchInTimeDate,
PunchOutTimeDate,
HoursWorked,
CoorCompany,
Country
FROM CDW_PROD_DB.FactRegisteredTime WHERE Country = 'NO';
LIB CONNECT TO [Microsoft_SQL_Server (network_querty)];
left Join (Time)
[Employee]:
LOAD
[empno],
IF([info_5]='TT','Timelønn',If([info_5]='TM','Timelønn',if([info_5]='T','Timelønn',IF([info_5]='TV','Timelønn','Fastlønn'))))
AS [Lønnstype];
SELECT
empno,
"info_5",
FROM "promark_dw_prod3".dbo."dw_employee";
The error I get is:
Seems my problem was more the placement of the [Employee]: statement.
When I moved it from above the LOAD to above the SELECT statement it seemed to work as I want.
left join
LOAD empno as [EmployeeId2],
info_5,
payrollprofid;
[Employee]:
SELECT empno,
"info_5",
payrollprofid
FROM "promark_dw_prod3".dbo."dw_employee";
The above works as I want it. Yay.
Hi, in fact, you can join two or more tables, the error that you have it's not triggered by a Qlik limitation, it triggered because you have a bad field call, maybe one of your field have a diferent name on a original table name.
Regards!
You are missing a 'SQL'.
SQL SELECT
empno,
"info_5",
FROM "promark_dw_prod3".dbo."dw_employee";
Check if below script is working in SQL or not, if yes than just run this script in qlik and than check where is the issue.
SELECT
empno,
"info_5",
FROM "promark_dw_prod3".dbo."dw_employee";
Seems my problem was more the placement of the [Employee]: statement.
When I moved it from above the LOAD to above the SELECT statement it seemed to work as I want.
left join
LOAD empno as [EmployeeId2],
info_5,
payrollprofid;
[Employee]:
SELECT empno,
"info_5",
payrollprofid
FROM "promark_dw_prod3".dbo."dw_employee";
The above works as I want it. Yay.
Hi
The SQL is not needed, when I add data using the Wizard from a SQL server it does not add it, and it does not stop the scripts.