Jump to content

Counting No of Records in a Portal


This topic is 2917 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I would appreciate a little help as my head is getting sore from banging it!

 

I have a 4 tables 

  • Students - pkStudentID, also contains name address etc
  • Classes - pkClassID, also date etc
  • SC_JoinTable - fkStudentID, fkClassID, fkCarnetID, payment method, payment amount

so far they are working ok, and I can have students attending many classes, as well as each class with multiple students.

 

Where I get stuck is how to structure my last table.

  • Carnets - pkCarnetID, fkStudentID

A carnet is a bulk purchase of Classes, in this instance of 6 classes (although that may change in the future) 

 

What I want to do is have a CarnetStatusField that switches to "inactive" once the student has attended all 6 (or Xnumber) classes.
I have a portal that shows the Classes::Date, etc...

where        SC_JoinTable::fkClassID = Classes::pkClassID

and            SC_JoinTable::fkCarnetID = Carnets::pkCarnetID

 

I can't seem to find a way to count the number of records in the portal.  Am I missing something simple or is my logic crazy?

 

 

Link to comment
Share on other sites

Perhaps I am missing something, but I see a fkCarnetID in the join table - so assuming a relationship:

 

Carnets::pkCarnetID = SC_JoinTable::fkCarnetID

 

each record in the Carnets table can count the "used up" registrations simply by =

Count ( SC_JoinTable::fkCarnetID )

--

 

I have a portal that shows the Classes::Date, etc...

where        SC_JoinTable::fkClassID = Classes::pkClassID

and            SC_JoinTable::fkCarnetID = Carnets::pkCarnetID

 

 

I am afraid that makes no sense: you can't have matchfields from two different tables on any side of the relationship.

Link to comment
Share on other sites

  • Newbies

Thank you for your reply.  

 

 

Perhaps I am missing something, but I see a fkCarnetID in the join table - so assuming a relationship:

 

Carnets::pkCarnetID = SC_JoinTable::fkCarnetID

 

each record in the Carnets table can count the "used up" registrations simply by =

Count ( SC_JoinTable::fkCarnetID )

 

 

This counts all records with "any" value in the SC_JoinTable::fkCarnetID field.

 

I need to count all records with a "specific" value in said field.

 

Link to comment
Share on other sites

This counts all records with "any" value in the SC_JoinTable::fkCarnetID field.

 

I need to count all records with a "specific" value in said field.

 

 

Which specific value would that be?

 

 

The specific value is the pkCarnetID field value.

 

 

I don't think you have tried this, have you? Because if you had, you would have seen that it counts only related records. An related records, by definition, are those where SC_JoinTable::fkCarnetID = Carnets::pkCarnetID.

Link to comment
Share on other sites

This topic is 2917 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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