May 5, 20205 yr 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?
May 5, 20205 yr 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?
May 5, 20205 yr Author 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
May 5, 20205 yr 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, 20205 yr by comment
May 5, 20205 yr Author 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.
May 5, 20205 yr 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).
May 5, 20205 yr Author 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"
Create an account or sign in to comment