5 Replies Latest reply on Aug 6, 2013 3:10 PM by philmodjunk

    Multiplying row values from 2 different portals of different table

    DranLang

      Title

      Multiplying row values from 2 different portals of different table

      Post

           I have two different portals of two different tables (PORTAL1 ::QTY and PORTAL2:: PRICE), I want to multiply them and put the result in a field from PORTAL1 (PORTAL1::TOTAL) but when I do, it keeps multiplying the QTY  to the first record in PORTAL2 (PRICE).  How can I solve this, thank you everyone!

        • 1. Re: Multiplying row values from 2 different portals of different table
          philmodjunk

               What data in Portal2 matches a specific entry in Portal 2 to a specific entry in Portal 1?

               The fact that two records in two different portals are in the same portal row, does not automatically link them.

               It would also help to explain the purpose of both portals on this layout. (we might then suggest a better alternative.)

          • 2. Re: Multiplying row values from 2 different portals of different table
            DranLang

                 I see your point, currently I have nothing.  The PRICE in portal 2 are the prices of different items and QTY in PORTAL1 is manually entered based on the number of orders.  So I would need to create a specific entry for them to have something in common, like a delivery number?

            • 3. Re: Multiplying row values from 2 different portals of different table
              philmodjunk

                   You have a number of options, but somehow you need to select an item from the second portal to assign it to an item in the first. This sounds a lot like an invoices layout where portal 1 has the list of items purchased and you are attempting to use portal 2 to select the items that are purchased.

                   If that is accurate, I suggest taking a closer look at how the invoices starter solutions that come with FileMaker 11 and 12 are set up to work. You use just one portal, but use a value list in that portal row to select each product.

                   Another approach that can work is to set up the portal fields in Portal 2 as buttons. Clicking a portal row in that portal then performs a script that creates a new record in Portal 1 with the correct Product ID to link it to a product record.

              • 4. Re: Multiplying row values from 2 different portals of different table
                DranLang

                     Thanks Phil! I got it to multiply properly, now I tried to get the sum of the values of the Total field (I used Sum(total) but it's only giving me the value in the first record and not the sum of all the total.  Is there another way to add those (total) values?

                • 5. Re: Multiplying row values from 2 different portals of different table
                  philmodjunk

                       Have you looked up Sum in FileMaker help?

                       The correct syntax to compute the total of records in an (unfiltered) portal is:

                       Sum ( POrtalTableOccurrence::Field )

                       Sum ( FieldName ) is the same as saying "compute the sum of 5" which is just 5. You need a reference that refers to all the related records.

                       and you define the calculation to evaluate in the layout's table from the context of the layout's table occurrence.