7 Replies Latest reply on Jan 19, 2012 1:08 PM by philmodjunk

    Summarizing Fields in a portal

    MarkJohnson1069

      Title

      Summarizing Fields in a portal

      Post

      I am using the invoice model, and have add a field "melted" which is set to either 0 or 1 for No and Yes. In the portal I am able to turn this on and off. I would like to total a field called "cCategoryTotal" for all checked invoices in the portal. Can someone tell how can I achieve this?

       

        • 1. Re: Summarizing Fields in a portal
          philmodjunk

          Weren't you helped in this issue already? I'd hate to start from square one all over again here as we may just be repeating past suggestions that did not work for you.

          • 2. Re: Summarizing Fields in a portal
            MarkJohnson1069

            Yes. I got an answer saying to use a report, however I did not want to use a report, so I created a portal for the invoice file. I now only need a way to accumulate the totals.

            • 3. Re: Summarizing Fields in a portal
              philmodjunk

              In the portal's table, define a summary field, sTotalOfcategoryTotal an and set it to compute the total of your cCategoryTotal field.

              Add a one row portal to the same table occurrence as your first portal and set up a portal filter expression that only allows related records for "melted" invoices. Put sTotalOfcategoryTotal inside this filtered portal and it will display the total of all "melted" records listed in your portal. If you are updating that field in this same portal, you may need to use a script trigger with that field to commit the record and/or refresh the window to get the summary field to update with the new total.

              • 4. Re: Summarizing Fields in a portal
                MarkJohnson1069

                Thanks for the quick response. I however left something out of my description. The field that I am toggling is another field call "update", so the total is only for portal records with this file toggled. I already did what your comment stated and it gives the total of all records in the portal but I only want the selected totals. This is my final question. My project will be complete after this.

                • 5. Re: Summarizing Fields in a portal
                  philmodjunk

                  If you use a portal filter, the filter expression can be set up to limit the total to only those related records with the specified values. Assuming "update" = 1 when "toggled", you could use this expression for all portal records where Melted = 1 and Update = 1:

                  PortalTable::Update AND PortalTable::Melted

                  (Use the table named in "Show Related Records From" in portal setup in place of "portalTable".)

                  • 6. Re: Summarizing Fields in a portal
                    MarkJohnson1069

                    It worked fine, however how I store that value outside the portal to use in another calculation?

                    • 7. Re: Summarizing Fields in a portal
                      philmodjunk

                      Unfortunately, calculation fields defined in the parent record will ignore portal filters when they refer to data in a related table.

                      If you cannot define the calculation field in the portal's table we'll need a relationship that filters on these two values instead of a portal filter.

                      You can define a field as constOne as a calculation field that returns the constant: 1 as its value. Then this relationship will match to all records in the portal table that have update = 1 and melted = 1

                      ParentTable::PrimaryKey = FilteredTable::ForeignKey And
                      ParentTable::constOne = FilteredTable::Update And
                      ParentTable::constOne = Filteredtable::Melted

                      This will work for you portal (no filter now needed) and you can use calculations defined in the parentTable such as:

                      FilteredTable::SummaryField * PercentDiscount