6 Replies Latest reply on Nov 10, 2013 11:42 PM by ultranix

    Portal Row Number?



      Portal Row Number?


           Hey, I want to have a field portal_row, which would calculate portal row number.

           I am using standard invoicing solution, two tables are important here - Invoices and Lines. So, I'm in Invoices layout and adding products via portal which is based on LINES table. So, let's say, if 1st row in Invoice is Black Coffee and 2nd row is Latte, i want for both records to hold value 1 and 2 respectively in LINES::portal_row.

           How do i do that?

           Get(ActivePortalRow) is not an option, as I'm going to use those numbers outside the Invoices layout.

           Thanks in advance

        • 1. Re: Portal Row Number?

               Here's a demo file that illustrates a way that you might be able to adapt to your purposes: https://www.dropbox.com/s/ggjy88cgkescopy/CategorySerialNos.fp7

               Each "category" could be one invoice. Open the demo from FileMaker 12's File menu to get a copy converted to the .fmp12 format.

          • 2. Re: Portal Row Number?

                 Well, partially. As for "no-error" approach, it would work fine. But I want for it to have conditional functionality (and therefore be formatted as "Calculation", instead of Auto-enter Number Field), for cases, when user mistakenly added portal row with incorrect value selected from drop-down, so, if such a case is row #17 and it is later deleted (I have "x" button with a script that deletes portal row at the very right of the portal line), then the sequence is like this 15, 16, 18, 19 (and no 17, which is deleted). And I would like for it to adjust so that no numbers in the sequence are omitted.

            • 3. Re: Portal Row Number?

                   Then you'll need to add a script that "fixes" the sequence when that occurs. Go To Related Records or a scripted find can isolate the portal records on a found set based on the portal's table. Then Replace Field Contents with the serial number option can renumber them.

              • 4. Re: Portal Row Number?

                     Could you hook me up with script? I believe that scripted find is the preferred option.

                • 5. Re: Portal Row Number?

                       Maybe you don't need it. Consider this alternative:

                       If the portal records have an auto-entered serial number, sorting them in ascending order will sort them in the order you want. Editing the serial number, even to add serial number with a decimal such as 2.5 can be used to change an item's position in the order. Then, with the records sorted on this field, the record number symbol will display a gap free sequence of values and a running count summary field can provide the same numbering on reports where you might have groups of the same portal records from multiple invoices as might be needed in some summary reports.

                       If you do want to do a scripted find (GTRR uses fewer script steps), it'd be patterned after this generalized outline:

                       Set Variable [$InvoiceID ; Invoices::__pkINvoiceID ]
                       Go to Layout ["PortalTable" (PortalTable)]
                       Enter Find Mode []
                       Set Field [PortalTable::_fkInvoiceID ; $InvoiceID ]
                       Set Error Capture [on]
                       Perform Find []
                       Replace Field contents [No dialog ; PortalTable::SerialNumber ; SerialNumbers ]
                       Go to Layout [original layout]

                  • 6. Re: Portal Row Number?

                         Thanks, running count summary field was enough.