Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Counting by group in a portal

Featured Replies

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?

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?

 

  • 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

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

  • 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.

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).

 

  • 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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.