Jump to content

Counting by group in a portal


Recommended Posts

Hello good afternoon,
I have 3 tables (Students - Readings - Books) related
Students (ID; Name); Books (ID; Title); Readings (uuid; Date; fk_Studente; fk_Book)

Students --- <Readings> ---- Books

I intend to show a portal which books were ordered per student, how many times he took each book, knowing that he can take the same book more than once.

I did follow this steps: https://scarpettagroup.com/filemaker-portal-show-distinct-value-tutorial/  to group the book.

Any help to maker the counting by group?

Link to post
Share on other sites
3 minutes ago, Helder Moreira said:

I intend to show a portal which books were ordered per student, how many times he took each book, knowing that he can take the same book more than once.

Do you mean a portal placed on a layout of Students? Showing which books were ordered by the currently viewed student?

 

5 minutes ago, Helder Moreira said:

Any help to maker the counting by group?

What exactly is a "group" here? A group of readings of the same book by the same student?

 

Link to post
Share on other sites

Do you mean a portal placed on a layout of Students? Showing which books were ordered by the currently viewed student?

Yes, a portal placed on a layout of Students. exactly 

2 minutes ago, comment said:

What exactly is a "group" here? A group of readings of the same book by the same student?

 

Group of books

Link to post
Share on other sites

If you want to see which books were read by the currently viewed student, with each title appearing only once, you can simply place a portal to the Books table onto the layout of Students. There is no need to add anything to your file's schema for this.

I am afraid I still don't understand your counting requirement. What is a "group of books"? Grouped by what?

 

Edited by comment
Link to post
Share on other sites
6 minutes ago, comment said:

If you want to see which books were read by the currently viewed student, with each title appearing only once, you can simply place a portal to the Books table onto the layout of Students. There is no need to add anything to your file's schema.

I am afraid I still don't understand your counting requirement. What is a "group of books"? Grouped by what?

 

on the book's portal within the student layout, it should show all the books the student has picked up; To avoid presenting repeated books, I intend to show this book only once but showing a counter how many times this book has been taken.

Link to post
Share on other sites

Okay, then.

My preferred method for this is to add a global StudentID field to the Books table. Then add a calculation field cCountReadings (result is Number) =

ValueCount ( FilterValues ( List ( Readings::fk_Studente ) ; gStudentID ) )

Next, define a script that does:

Set Field ( Books::gStudentID ; Students::ID ]

On the layout of Students, place a portal to Books showing the Title and cCountReadings fields. In Layout Setup, add a OnRecordLoad script trigger that calls the above script.

This will cause each book to count the number of related readings by the currently viewed student (whose ID is in the global field).

 

  • Like 1
Link to post
Share on other sites
2 hours ago, comment said:

Okay, then.

My preferred method for this is to add a global StudentID field to the Books table. Then add a calculation field cCountReadings (result is Number) =


ValueCount ( FilterValues ( List ( Readings::fk_Studente ) ; gStudentID ) )

Next, define a script that does:


Set Field ( Books::gStudentID ; Students::ID ]

On the layout of Students, place a portal to Books showing the Title and cCountReadings fields. In Layout Setup, add a OnRecordLoad script trigger that calls the above script.

This will cause each book to count the number of related readings by the currently viewed student (whose ID is in the global field).

 

Finally it works... :)  you saved my day.

THANK YOU SO MUCH.... "MUITO OBRIGADO"

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.