Page 1 of 1

How many days is the teacher coming?

PostPosted: Tue Nov 10, 2009 6:56 pm
by steppon
Hi
I have a question I have been working for a while :shock: and it would be really nice if I could have a hint. :roll:
Sorry if I go straight to the problem: :oops:

I have few teachers working in a school.
The event to consider is the lesson.
I want to count how many days is the teacher coming in a month to pay the transportation. If the teacher come 2 times or more in one day the transportation is payed just one time.

Sometimes the lesson is cancelled from the student.
In this case the teacher do not come but the lesson is payed.

In fact I want to count the times the teacher is coming per month.
But of course I do not want to count the cancelled lesson.
So if there is just on cancelled lesson in one day means the teacher did not come. If there are 2 lessons in one day and one lesson is cancelled means the teacher come. If there are 2 lessons and both are cancelled means the teacher did not come....

I hope it is easy to understand :cry:

Many many many many many thanks in advance

Stefano

PostPosted: Wed Nov 11, 2009 7:28 am
by John Sindelar
Hi Stefano,

So first you want to script a find on the appointment list or table that gathers all the records you want to count. So you'll write a find that looks for appointments in the particular month, for that teacher, omitting cancels.

Now you have a list of appointments though you may have the same day there twice. Sort this list by date.

Now all you have to do is count the unique dates. This is probably easiest in a looping script: start at the first record add its date to your counter (which is probably a $variable), go to the next date. If the next date is the same as the last date, skip it and go to the next record. If the date is new, increase your counter by one.

There are also come custom functions that can do this counting if you're using FileMaker Advanced. Check out this for unique values: http://www.briandunning.com/cf/596

And this for gathering the list of dates from your found set to feed into the previous function: http://www.briandunning.com/cf/868

Hope that helps get you started.

PostPosted: Thu Nov 12, 2009 9:58 am
by steppon
Thank you John,
you are always very nice.

I think I will try with the last solution as I have the advance version.

I got so busy lately. Let me have a go this weekend.
I still have also to work with the window size.
I will let you know as soon as I will do it.

Thanks again

STefano