Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
We value your feedback – take our 5-minute QlikView modernization survey
cancel
Showing results for 
Search instead for 
Did you mean: 
sudhir0538
Creator
Creator

Fetching data between 2 time stamps with AM and PM

Hello Community, I had a time stamp field with AM and PM values. and my requirement is to fetch the data between previous day 10 PM to current day 9.59 PM. Please help to do it in script level. field name is TIMESTAMP_TAREWT

Sample data attached for your reference.

1 Solution

Accepted Solutions
QFabian
Specialist II
Specialist II

Hi @sudhir0538 , please check if this script works for you :

be carefull with the variables, because i had problems with the comma as decimal separator, but it works!


Let vBegin = num(today()-1) + 0.916666666666667;
Let vEnd = num(today()) + 0.916666666666667;

LOAD

LADLENO,
GROSSWT,
TAREWT,
NETWT,
TAPNO,
TIMESTAMP_GROSSWT,
TIMESTAMP_TAREWT
FROM [C:\Users\fquez\Desktop\Raw_data.xlsx] (ooxml, embedded labels, table is Sheet1)
Where
TIMESTAMP_TAREWT >= $(vBegin) and TIMESTAMP_TAREWT <= $(vEnd)
;

 

QFabian

View solution in original post

3 Replies
QFabian
Specialist II
Specialist II

Hi @sudhir0538 , please check if this script works for you :

be carefull with the variables, because i had problems with the comma as decimal separator, but it works!


Let vBegin = num(today()-1) + 0.916666666666667;
Let vEnd = num(today()) + 0.916666666666667;

LOAD

LADLENO,
GROSSWT,
TAREWT,
NETWT,
TAPNO,
TIMESTAMP_GROSSWT,
TIMESTAMP_TAREWT
FROM [C:\Users\fquez\Desktop\Raw_data.xlsx] (ooxml, embedded labels, table is Sheet1)
Where
TIMESTAMP_TAREWT >= $(vBegin) and TIMESTAMP_TAREWT <= $(vEnd)
;

 

QFabian
sudhir0538
Creator
Creator
Author

Hello @QFabian , Thank you for the solutions. It worked pretty well. 

Please explain those 2 variables and the constant value. TIA.

QFabian
Specialist II
Specialist II

Sure @sudhir0538 ,

Let vBegin = num(today()-1) + 0.916666666666667;

Today() -1 (yesterday) : 19-01-2020
as a number : 43.849
hour : 22:00
as a number, is the decimal part : 0,916667
So, when  you sum both 43.849 + 0,916667  -->  43849,916667  and  if you show it as a timestamp :
19-01-2020 22:00

 


Let vEnd = num(today()) + 0.916666666666667;
today() : 20-01-2020
as a number : 43.850
hour : 22:00
as a number, is the decimal part : 0,916667
So, when  you sum both 43.850 + 0,916667  -->  43850,916667  and  if you show it as a timestamp :
20-01-2020 22:00

QFabian