Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all ,
is it possible to store an specific time value in a variable
for ex if have 2 columsn
employee ¦ intime
1 ¦ 2015-10-23 09:09:10
2 ¦ 2015-10-23 09:00:10
3 ¦ 2015-10-23 09:01:11
4 ¦ 2015-10-23 09:07:18
5 ¦ 2015-10-23 08:09:23
for example:let vTimestandard =8:00
then compare intime.. here I need to check all the intime greater than vtimestandard
Yes you can store a time value in a variable, but to make it comparable you will need them to be at the same level. Like for right now your column intime contains date as well as time, but you variable only contains time. The comparison won't work this way. You can compare time to time or timestamp to timestamp.
Does that make sense?
hi yes I have made another column .which I forgot to mention
employee ¦ intime ¦ scantime
1 ¦ 2015-10-23 09:09:10 ¦ 09:09:10
2 ¦ 2015-10-23 09:00:10 ¦ 09:00:10
3 ¦ 2015-10-23 09:01:11 ¦ 09:01:11
4 ¦ 2015-10-23 09:07:18 ¦ 09:07:18
5 ¦ 2015-10-23 08:09:23 ¦ 08:09:23
still how do I compare can u share the script? I tried hardcodeing value to variable but it is not working
Yes you can for example in a load script:
LET vTimestandard = Num(Time('08:00:00'));
LOAD
employee,
intime,
Frac(intime) > $(vTimestandard) AS IsLate
INLINE [
employee ¦ intime
1 ¦ 2015-10-23 09:09:10
2 ¦ 2015-10-23 09:00:10
3 ¦ 2015-10-23 09:01:11
4 ¦ 2015-10-23 09:07:18
5 ¦ 2015-10-23 08:09:23
] ( delimiter is '¦');
If you want to do this in the script, than you can do it Petter's way. For front end solution you can look at the attached image and qvw file.
The expression I am using here is: =Only({<Time = {"$(='>=' & vTimeStandard)"}>}inTime)
and variable vTimeStandard = =Time(Time#('8:00', 'h:mm'))
HTH
Best,
Sunny
hi sunny,
=Time(Time#('8:00', 'h:mm')) this comparison is not working 24 hrs time
for ex: =Time(Time#('18:00', 'h:mm')) if I try .. I does not work..how can make it for 24 hrs time
See if this helps:
=Time(Time#('18:00', 'hh:mm'))
LET vTimestandard= frac(Time#('08:00:00','hh:mm:ss'));
Data:
LOAD *,
if(frac(Time) >'$(vTimestandard)',1,0) as TimeFlag;
load *,Time(intime,'hh:mm:ss') as Time,
date(intime) as Date INLINE [
employee, intime
1, 2015-10-23 09:09:10
2, 2015-10-23 09:00:10
3 ,2015-10-23 09:01:11
4, 2015-10-23 09:07:18
5, 2015-10-23 08:09:23
6, 2015-10-23 07:09:23
] ;
Create straight Table
Dimensions:
employee
Date
Time
Expression
=Only({<TimeFlag={'1'}>}intime)
hi guys ,
can you tell me ..hoiw could I put between for vTimestandard
LET vTimestandard= frac(Time#('08:00:00','hh:mm:ss'));
for example: I need to set timings between 8PM(20:00), in the night until morning 6 AM - I need only that specifc data