Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I am trying to perform an incremental load routine, where I am trying to define the new data based on data after a certain time. I have a timestamp in the data on which I tried to define a variable "maxdate" which defines the latest date.
I have two questions (see below for code) :
1) My timestamp has the column name "STIME" and is of following format: 181203 00:02 (ie.: YYMMDD hh:mm). Do I have to specify which column in the original data is my timestamp or does qlik understand through:
SET TimestampFormat='YY.MM.DD hh:mm[.fff]';
2) Trying to implement the incremental load routing I am getting following message:
"The following error occurred:
Field 'a' not found
The error occurred here:
?"
// 1. Primary Data Load
data1:
LOAD
STIME,
//Date(Date#[STIME],'YYYY-MM-DD hh:mm'), AS STIME,
// Date(Floor([STIME])) as Date,
NE_ID,
OBJID,
CALLSETUPDURATION,
CALLSETUPSUCCESSRATIO
FROM [lib://Incremental Load/ZafacoLoad1.xlsx]
(ooxml, embedded labels, table is Zafaco181203);
//2. Create a qvd file.
store data1 into 'lib://QVD/ZafacoTest.qvd';
drop table data1;
//3. Find maximum date.
max_date:
LOAD
max(STIME) as Maxdate
FROM 'lib://QVD/ZafacoTest.qvd'(qvd);
//4. Store Maximum date in a variable.
Let Maxdate = floor(peek('Maxdate'));
//5.Pull new rows/delta.
data2:
NoConcatenate
LOAD
STIME,
NE_ID,
OBJID,
CALLSETUPDURATION,
CALLSETUPSUCCESSRATIO
FROM [lib://Incremental Load/ZafacoLoad2.xlsx]
(ooxml, embedded labels, table is Zafaco181205)
where STIME> $(Maxdate);
//6 Concatenate.
Concatenate (data2)
LOAD
STIME,
NE_ID,
OBJID,
CALLSETUPDURATION,
CALLSETUPSUCCESSRATIO
FROM [lib://QVD/ZafacoTest.qvd] (qvd);
STORE data2 into [lib://QVD/ZafacoTest.qvd] (qvd);
Your column STIME is being loaded as text. therefore the variable is null.
thats the reason for the error
Thanks Dilipranjith for the quick response.
How do I define STIME as date/timestamp? How do I troubleshoot?
Thanks Dilipranjith. Unfortunately, it didn't work. I have implemented as advised
data1:
LOAD
STIME,
Timestamp#(STIME,'YYMMDD hh:mm') as STIME,....
I am now however getting following error message:
remove the first one
data1:
LOADSTIME,
Timestamp#(STIME,'YYMMDD hh:mm') as STIME,....
Thanks Dilipranjith! This is progress, initial error code resolved. Im getting following error code after implementing as suggested:
// 1. Primary Data Load
data1:
LOAD
Timestamp(STIME,'YYMMDD hh:mm') as STIME,
NE_ID,
OBJID,
CALLSETUPDURATION,
CALLSETUPSUCCESSRATIO
FROM [lib://Incremental Load/ZafacoLoad1.xlsx]
(ooxml, embedded labels, table is Zafaco181203);
//2. Create a qvd file.
store data1 into 'lib://QVD/ZafacoTest.qvd';
drop table data1;
//3. Find maximum date.
max_date:
LOAD
max(STIME) as Maxdate
FROM 'lib://QVD/ZafacoTest.qvd'(qvd);
//4. Store Maximum date in a variable.
Let Maxdate = floor(peek('Maxdate'));
//5.Pull new rows/delta.
data2:
NoConcatenate
LOAD
//STIME,
Timestamp(STIME,'YYMMDD hh:mm') as STIME,
NE_ID,
OBJID,
CALLSETUPDURATION,
CALLSETUPSUCCESSRATIO
FROM [lib://Incremental Load/ZafacoLoad2.xlsx]
(ooxml, embedded labels, table is Zafaco181205)
where STIME> $(Maxdate);
//6 Concatenate.
Concatenate (data2)
LOAD
STIME,
NE_ID,
OBJID,
CALLSETUPDURATION,
CALLSETUPSUCCESSRATIO
FROM [lib://QVD/ZafacoTest.qvd] (qvd);
STORE data2 into [lib://QVD/ZafacoTest.qvd] (qvd);
// // Comments
// // max(timestamp(Date, 'YYYY/MM/DD hh:mm.ff')) as Maxdate