Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 5 Monaten
Letzter Beitrag:
vor 2 Jahren, 5 Monaten
Beteiligte Autoren:
Arie, Allard, Fabrice Harari, Joel

How to count attendance weekly

Startbeitrag von Joel am 21.01.2016 18:46

I'd like to make a little routine that would produce something like this:


It's a little visual to tell me how consistent my students are training each week. The part I can figure out is how to cycle through the database. The data base just has records each day a student attends (this can be broken down by program as it has a filed for ProgramID)

So I need a routine that does this...

Cycle through the records by week and then determine how many classes they took that week. Then it's a simple matter of printing them out. So something like this:

For Each "Week"
Total attendance for this week
Add it to the string as a number

Anyone have any ideas?


Hi Joel

first, you need to loop on all the records of one student, and not on the weeks
then for each record, you do a datetoweek of the attendace date to find the matching week and you add 1 to that week
Weeks can be stored in an array, a table, or anything of the kind.

At the end, you loop on your array to build the string

Best regards

von Fabrice Harari - am 22.01.2016 00:00

You can save a week number with a date. After that you can just do a
for each loop.

Or you can just run a querie that does the week stuff and then do a for each loop on the querie No need to use array's


von Allard - am 22.01.2016 08:34

I'm using an extra "dates" table for these kind of tasks. It's used to simplify the records you read. In the end you still have to loop through the recods and build your concatenated string. That part is hard to do using sql/queries.

The "dates" table hold a few fields
Date Date
Day int (1-7)
Week int (1-53)
Month is int (1-12)
Year int

You have to fill the table with records once, for each day let's say from 2010-2050

Then you can JOIN this table with others based on the date. You will then have the daynumber, week,month,year in every record, ready to use.
I.e. for calculating a sum-per-week.
A plus is that you are able to get records on days the students did not have any class

von Arie - am 22.01.2016 08:46
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.