2 Replies Latest reply on Oct 22, 2013 1:25 PM by 914928

    Question on entities


      I am working on a project using OPM 10.3 where I collect information on jobs using an entity called 'the job'.  Part of the requirement is to work out the daily average hours, which is proving problematic where an individual has more that one job.  Using a timeline, I have had no trouble displaying the average hours worked for each job, but is it possible to add up the average for multiple jobs?


      Data collected for the job entity:

      • the job start date
      • the job end date
      • the number of hours worked per day


      Example scenario:  During the 2012/13 tax year (6th April 2012 - 5th April 2013), Dave worked in a bank from Monday - Friday from 9am - 5pm.  From 1st August 2012 - 1st November 2012 Dave worked nights in a pub from 8pm - midnight.


      The determination should reveal that Dave worked 8 hours per day from 6th April 2012, then 12 hours per day from 1st August 2012 and then went back to 8 hours per day from 1st November 2012.  Is this possible to work out from 'the job' entity or will I have to find another way?


      Any help would be appreciated.


      P.S.  Please ignore the fact that Dave doesn't work weekends, Bank Holidays etc.

        • 1. Re: Question on entities

          My knowledge of temporal reasoning isn't the best, but here's my simple solution.


          Step 1 is to turn the job start date, the job end date and the number of hours worked per day into a temporal value for each job, you can do this with a table rule and the TemporalOnOrAfter and TemporalOnOrBefore functions



          | The temporal hours worked per day                                         |


          | the number of hours worked per day | TemporalOnOrAfter(the job start date); and    |

          |                                    | Either                                        |

          |                                    |     TemporalOnOrBefore(the job end date); or  |

          |                                    |     the job end date is uncertain          |


          | 0                                  | otherwise                                     |



          Step 2 sum all the jobs at the person (Im assuming the global)  to give you total hours worked


          total hours worked for all jobs = InstanceSum(all instances of the job, The temporal hours worked for the job)


          The value, total hours worked for all jobs, will be a temporal value of the total hours worked. It should look something like:


          {0, 8.0 from 2012-04-05, 12 from 2012-08-01, 8.0 }


          Hope this helps.




          • 2. Re: Question on entities

            Thanks Frank.  This is exactly what i was looking for.