Solved

Group Dates by 24 hr blocks

  • 6 January 2020
  • 3 replies
  • 1 view

IM trying to read a lmgrd9.log file, i can see most of what i need, but need to group the time stamps into 24 hour blocks and the assign the correct date to that to give a date/timestamp - Then i wish to join the OUT and IN with the user name to give a duration - this will end up in a powerbi report so can do some there.

icon

Best answer by hollyatsafe 6 January 2020, 23:59

View original

3 replies

Badge +2

Hi @frankers,

This is an interesting project, I've taken a look at your workflow and have some ideas...

For the timestamp rather than using the TIMESTAMP line I decided to explore using the 'Time: Thu Nov 14 2019 20:04:42 W. Australia Standard Time' line, this is because this seems to reliably be printed just after midnight every day, so before there has been any user activity. Therefore we can use Adjacent Feature Attribute Handling in the Attribute Manager to assign the Date to all subsequent features that are missing the Date value.

Then to calculate the difference between IN and OUT times these values must sit on the same feature so they can be used in the DateTimeCalculator. This is where things get tricky as for each user there are not always a pair for each date. E.g. user may sign IN but never OUT on a single day.

 

I decided to use a conditional statement along with adjacent feature attribute handling to try and determine IN / OUT pairs for a single user per day. However this means the above scenarios have been ignored so additional steps will need to be taken to determine how to handle these. I suspect there are better ways to do this, but hopefully these ideas will help you get started. Please find attached a workspace with annotations to explain my thoughts.

ESRI_LICENSES_HCEdit.fmwt

Userlevel 3
Badge +17

Hi @frankers,

This is an interesting project, I've taken a look at your workflow and have some ideas...

For the timestamp rather than using the TIMESTAMP line I decided to explore using the 'Time: Thu Nov 14 2019 20:04:42 W. Australia Standard Time' line, this is because this seems to reliably be printed just after midnight every day, so before there has been any user activity. Therefore we can use Adjacent Feature Attribute Handling in the Attribute Manager to assign the Date to all subsequent features that are missing the Date value.

Then to calculate the difference between IN and OUT times these values must sit on the same feature so they can be used in the DateTimeCalculator. This is where things get tricky as for each user there are not always a pair for each date. E.g. user may sign IN but never OUT on a single day.

 

I decided to use a conditional statement along with adjacent feature attribute handling to try and determine IN / OUT pairs for a single user per day. However this means the above scenarios have been ignored so additional steps will need to be taken to determine how to handle these. I suspect there are better ways to do this, but hopefully these ideas will help you get started. Please find attached a workspace with annotations to explain my thoughts.

ESRI_LICENSES_HCEdit.fmwt

I agree with Holly's method of using Adjacent Feature Attribute Handling to deal with adding date information to features. It makes great use of the chronological structure of the your input data.

I would also like to mention your workspace does not currently handle log entries where the hour is in single digits (eg. like line 234 of your log file). The first character of a single-digit hour is a space character. The workspace splits on spaces in the first AttributeSplitter and these single-digit hour entries are output from the Unfiltered port of the AttributeFilter as the attributes do not contain the correct attribute value.

If you replace spaces at the beginning of the text_line_data attribute with no replacement character, you should see an increase in the combined number of valid features data from around 5,000 to 36,000 features. I hope this helps.

@hollyatsafe @debbiatsafe

Thanks to you both got a nice system running now - still working on the license checked out over night but i can live with that for now

Reply