8 Replies Latest reply on Aug 21, 2014 1:22 PM by tays01s

    Portals: Updating of calculation fields

    tays01s

      Title

      Portals: Updating of calculation fields

      Post

           I have 2 portals from the same table on a single layout. It's useful to have them separate in this case. However, when I alter data in portals 2, the calculation fields in portal 1 only update when I click into that portal or select a record in the portal. Can I make the updating automatic?

        • 1. Re: Portals: Updating of calculation fields
          philmodjunk

               What happens if you click the layout background outside of both portals? Do you then get an update of this value?

               If so, you need only commit records (what happens with this click of the layout background) to get things to update that can be scripted with a trigger performed script with triggers specified for the fields where an edit will change the result shown in the calculation field.

               If that isn't it...

               You'll need to describe the design of your database before we can attempt an answer.

               What tables, relationships, portal filters etc make up the design of this layout with two portals?

               What does the calculation field calculate and how? (you can copy and paste the calculation here for others to see it.)

          • 2. Re: Portals: Updating of calculation fields
            tays01s

                 No clicking on the layout doesn't cause updating, only if I click into the portal.

                  

                 Relationships of tables: IO --< Drugs.

                 1. IO has 2 portals: a. Summarises prescription dose and actual input dose; b. details some clinical data that can affect input dose. 1 record for IO has some fields in a. and some in b.

                 2. Drugs has one portal showing drugs prescribed and given. Changing either of these immediately updates in portal 1a. However, changing data in 1b. only causes an update in 1a. if I click into that portal. I have tried using a script trigger for commit records, but it had no effect.

                 Lastly, there are no portal filters. The drugs related to IO are brought up via a script.

            • 3. Re: Portals: Updating of calculation fields
              philmodjunk

                   That didn't really provide the info that I need to understand your design.

                   IO has 2 portals.... Drugs has 1 portal

                   That's a total of up to 3 different relationships and I don't know what you've set up for match fields in these relationships.

                   So IO----<Drugs is pretty vague here.

                   The portal on your Drugs layout, for example, would imply a one to many relationship from Drugs to some other table. And I see no such table and no such relationship in what you have posted.

                   And I still await an answer to this question:

                   

                        What does the calculation field calculate and how? (you can copy and paste the calculation here for others to see it.)

                   The way you define the calculation, whether any summary fields are involved, the details to your relationship structure all can affect the results that you get here. Best guess is that you have something that requires FileMaker to "tunnel" through multiple relationships in order to calculate the result that you want, but that's just a guess at this point, it may not be correct.

              • 4. Re: Portals: Updating of calculation fields
                tays01s

                     There are 2 portals from IO2 and 1 from DrugsUsed2, all on a Patient layout based on the Patient table.

                     Relationships:

                     - Patient::ID to IO::_PatientID

                     - Patient::IO_n to IO2::_PatientID

                     and

                     - IO::ID to DrugsUsed::_IOID

                     - Patient::DrugsUsed_n to DrugsUsed::_IOID

                     Calculation: IO::DrugsAmount is based on Sum(DrugsUsed::Amount)

                • 5. Re: Portals: Updating of calculation fields
                  philmodjunk

                       Are IO and IO2 separate tables or different occurrences of the same table?

                       

                            and 1 from DrugsUsed2

                       Sorry to be picky, but really hate to guess wrong. There's no "DrugeUsed2" in the relationships that you've described here.

                       Best guess here is that you have:

                       DrugsUsed2>------Patient----<IO-----<DrugsUsed   (---<)

                       But if so, what are the match fields between Patient and DrugsUsed2?

                       And what does one record in IO represent here? (perhaps this is the record for one procedure performed on the patient?)

                       I suspect that this script will update your screen for you, but it would be best to figure out a design change that makes it unecessary:

                       Refresh Window [Flush Cached Join Results]

                       And one record in DrugsUsed represents?

                        

                  • 6. Re: Portals: Updating of calculation fields
                    tays01s

                         Sorry, I tried to simplify description of the relationships:

                         Patient::ID to Calc::_patientID, Calc::ID to IO::_calcID, IOID to DrugUsed::_ioID, DrugUsed::_Drugs::ID

                         Patient::calc_n to IO2::_calcID & Patient::ioID_n to DrugUsed2::_ioID

                         Lastly: DrugUsed2::_DrugID to Drugs::ID

                         IO is input/output in terms of drugs and losses such as vomit.

                         A DrugsUsed record represent 1 drug (product) that has been used.

                    • 7. Re: Portals: Updating of calculation fields
                      philmodjunk

                           That makes a very, very big difference in the issue we are examining.

                           Did you try using Refresh Window [Flush Cached Join Results] to see if that enables everything to update?

                           That may not be the ideal solution, but it's a start and will confirm my guesses as to what is happening here.

                      • 8. Re: Portals: Updating of calculation fields
                        tays01s

                             The Refresh command caused all values to zero; they only came back corrected for the change when I re-selected the record. However, using your point, I triggered the record selection 'onexit' and the whole record updated correctly.

                             It would be better to do this 'onmodify' but after the first digit entered i get a warning: Before typing, press tab or click in a field or choose the new record menu command.