1 Reply Latest reply on Aug 4, 2015 3:36 PM by philmodjunk

    Counting Portal Rows

    TKnTexas

      Title

      Counting Portal Rows

      Post

      I have a simple database to do journal entries.  One Table (Parent) has one entry for each journal entry.  In a portal I added the debit and credit entries to make the journal entry (Child).  I need to make sure only XX lines are entered into the portal.

      Can I do real-time count the lines?  Do I have to commit the portal to update the count?  It is a printing issue to keep it to one page.  

      In the Parent table, I have a Calculation field COUNT(child::GLNum).  But it is blank on a record that has 17 portal records.  GLNum can never be empty.

      I was following this example:
      Portal Row Count

       

        • 1. Re: Counting Portal Rows
          philmodjunk

          The easiest way to limit the number of portal records is to remove the scroll bar. Then the number of portal rows that you specify in portal setup become a natural limit on the number that can be added.

          And yes the count will not update until you commit records. But instead of using "allow creation..." and an add row to add new portal records you can use a button that performs a script to create a new record. This script can check the current number of related records and if the limit has been reached, it can refuse to create another. Conditional formatting can provide visual feedback by greying out the button's label when the limit has been reached.