I have drivers doing jobs (logistics : pickup → drop off). The drivers are paid a fixed daily rate. We expect 4 jobs for that, any job after the 4th job earns an additional commission.
How should I approach this. How do I create a counter for each person, and then I need to create a counter per day for each person.
You’d want a table of jobs that consist of a pickup (time/location?) and dropoff. When there’s a drop-off, then a job is “complete”. The only tricky part is developing a calendar that group all jobs per day for each person.
All the jobs are in one table called JOB_TABLE, in each row I have all the info needed (created date, job date, pickup date, completion date, job type, driver_assigned)
I made some progress.
I used a maths formula to create a unique day (YYYYMMDD) and then I use template to add on the login-email of the driver.
I am then using a relation (multi-match) and then doing a rolloup count on that to give me the number of jobs each driver has done on each day.
BUT as the commission paid on the jobs after the first 4 varies depending on the type of job, I still have an issue. I need to order the jobs based on a completion data and then on the fifth job look at the type of job and give the appropriate bonus, that is where I am stuck. I somehow need to have a daily counter per driver that I use to label the job using an action at time the job completes.
Might need to index your jobs table per person/day. If index > 3 (starts with 0), then look at job type and provide compensation (through another relation/lookup).
That is an excellent suggestion and an awesome algo, I can use this for another project.
However, it may not work for me, I will see if I can make it work. This is assuming that the jobs are in order. My issue is that sometimes the jobs are not done in the order they are inserted into the table, so I would need to order it by job_start_datestamp
I got. Not sure if it is the right thing to do, but I created a LOOKUP colulmn pointed it to the query and that gave me an ARRAY, FIND ELEMENT INDEX on the LOOKUP and I have my index.