Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have date fields day and usage.
I need to have a filter say "time" where the filter value has to be "working" and "nonworking" , values , when i click on working , the usage value has to be calculated for the hour between 9am - 5pm when i click on nonworking , the usage has to be calculated for 5pm-9am
How do i achive this?
Please help.
You'll need a time of day field to calculate your new time field from. Assuming you have one, I suspect I'm missing an obvious and better way, but here's one possibility:
[Times]:
LOAD
"time of day"
,if("time of day">=maketime(9) and "time of day"<=maketime(17),'working','nonworking') as "time"
;
LOAD time(fieldvalue('time of day',iterno())) as "time of day"
AUTOGENERATE 1
WHILE len(fieldvalue('time of day',iterno()))
;
Oh, right. One simple way is to make a list box with an expression instead of a field, and put in the "time" expression from above:
if("time of day">=maketime(9) and "time of day"<=maketime(17),'working','nonworking')
You'll probably get significantly better performance by putting it in the script, though.
I still think I'm missing some easy and better way, though.
You'll need a time of day field to calculate your new time field from. Assuming you have one, I suspect I'm missing an obvious and better way, but here's one possibility:
[Times]:
LOAD
"time of day"
,if("time of day">=maketime(9) and "time of day"<=maketime(17),'working','nonworking') as "time"
;
LOAD time(fieldvalue('time of day',iterno())) as "time of day"
AUTOGENERATE 1
WHILE len(fieldvalue('time of day',iterno()))
;
Oh, right. One simple way is to make a list box with an expression instead of a field, and put in the "time" expression from above:
if("time of day">=maketime(9) and "time of day"<=maketime(17),'working','nonworking')
You'll probably get significantly better performance by putting it in the script, though.
I still think I'm missing some easy and better way, though.
Thank you for the response , but it does not work for me when i give the expression in the list box just nonworking is displaying ..
I Have created a list box with " working" and "nonworking" values in it and named it timeframe,
I have a field in my table called HOUR which has 24 hour timeframe , that mean i have values 1-24 in it , so when a user selects "working" from the timeframe filter usage( to display usage i have a graph with certain dimensions and expressions) for the hours 9 am to 5pm has to be displayed , that mean i have to see 9-17 numbers in the hour filter as higlighted.
Hi Ramya,
The suggestion posted by John should work . if not use the hour function ie
if(Hour(HOUR)>=9 and Hour(HOUR)<=17,'Working','Non Working').
if not just write in the script Hour(HOUR) AS Hours and use the Hours column for calculation.
Regards,
Chakravarthy.