6 Replies Latest reply on Oct 24, 2009 11:54 AM by Gert

    Why does global calculation not retrieve a related value?

    Gert

      Title

      Why does global calculation not retrieve a related value?

      Post

      2 files in a example solution:

       

      'Related':

       numeric field used for relation

       text field with name

       

      'globals' which should make some values available to other tables in the solution, as simple as possible.

       global number used as key in relation.

       global calculated field based on this relation.

       

      no other fields or records in this globals table.

       

      *) The calculated field remains empty. I can't find the rule why. It is updated when the storage is don't-store ; but then it is not available in other tables.

       

      *) When there are no records in the globals table, a related::name field on the layout for globals displays OK but I can't edit the  field . Is that logical?

        • 1. Re: Why does global calculation not retrieve a related value?
          philmodjunk
            

          In database design, picky little details frequently can trip you up.

           

          "The calculated field remains empty. I can't find the rule why."

          There are several possibilities. Please copy and paste the calculation expression (and whether you set this up using the Auto-enter tab or not) here and we'll take a look at it. It may also help to exactly describe any relationships that are involved.

           

          For more on how to ask for help in this forum, see this thread:

           

          When requesting assistance on this forum...

           

           

          • 2. Re: Why does global calculation not retrieve a related value?
            Gert
              

             

            Filemaker 10.0v3 on Windows XP sp3.

             

            The relation is working because a portal or related:: name on a layout is updated.

            The calculated field in globals is not updated.

             

            Screencopy

            • 3. Re: Why does global calculation not retrieve a related value?
              philmodjunk
                

              You need a record in Globals in order for a calculation field in Globals to be able to compute a value.

               

              It doesn't look like you need this field at all. You can simply place the Name field from Related anywhere you need to see/edit the name field's value.

               

              For example, if you have a layout based on Globals with a port showing records from Related, you can simply use the field tool to add Related::Name to your Globals based layout to see the name of the first related record in Related.

              • 4. Re: Why does global calculation not retrieve a related value?
                Gert
                  

                You need a record in Globals in order for a calculation field in Globals to be able to compute a value.

                This formulation is not exact, a global field that adds 2 to another global field is functioning with 0 records in the table.
                And the relation is updated with a change to Selector, even with 0 records.
                When not global the calculation works OK, whether stored or not stored.

                So calculating works and the relation works but the combination computation+relation+global is a problem. I didn't find a rule in the help or documentation that states this fact, so I assumed I could freely use it.

                The idea behind this construction was to have 1 table in this solution with globals that could simply be accessed without relations.

                One of the global values is something of a category-selector so several tables can work with a selection and in a mode for that category.

                To the user it looks like there are different tables but for the system functionality is shared.

                 

                 



                • 5. Re: Why does global calculation not retrieve a related value?
                  philmodjunk
                    

                  Gert,

                   

                  If there are no records in a given table, no calculation field defined in that table will show a value. Stored or unstored makes no difference. Global data fields yes, calculation fields no.

                   

                  I've been experimenting with this technique myself. Putting all global fields in one table can be very useful and no relationship is needed to access the data stored in them. However, I don't put fields used as relational keys in this table and I don't put calculation fields in this table.

                  • 6. Re: Why does global calculation not retrieve a related value?
                    Gert
                      

                    I guess it works like this:

                    Every field may have an invisible list with field-names and pointers to relations that are dependent on a change in this field.

                    (When a fieldname F occurs in a computation for field D, the name of D is will be on the list of F)

                    (When a fieldname F occurs in the keys for a relation R, the relation R will be on the list of F)

                     

                    A change in field F will propagate to the items in the list.

                      Fields will update and then propagate the update to the respective items in their lists.

                      Relations will update their 'found sets', other fields may change and propagate etc.

                     

                    Eventually the chain of propagation will stop, because circular paths are forbidden in relations.

                    Global fields will not take part in the middle of this chain when relations are involved, because it might create circular paths.

                    Luckily, inside a table it is of no use to have a global with a 'living copy' of a related value.