Helder Moreira Posted May 5, 2020 Posted May 5, 2020 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?
comment Posted May 5, 2020 Posted May 5, 2020 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?
Helder Moreira Posted May 5, 2020 Author Posted May 5, 2020 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
comment Posted May 5, 2020 Posted May 5, 2020 (edited) 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 May 5, 2020 by comment
Helder Moreira Posted May 5, 2020 Author Posted May 5, 2020 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.
comment Posted May 5, 2020 Posted May 5, 2020 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). 1
Helder Moreira Posted May 5, 2020 Author Posted May 5, 2020 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"
Recommended Posts
This topic is 1718 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now