6 Replies Latest reply on Jul 29, 2010 3:20 AM by HugoLidia

    Age recalculation issue



      Age recalculation issue


      Our client records store and dispaly the client's date of birth, next to which is a calcualte age field.  How do I get this to recalculate each time the record is displayed?  Guess it would be an additional step in script associated with the Client Load event.

        • 1. Re: Age recalculation issue

          The calculation field should be unstored unless that creates intolerable delays for any commonly performed finds or sorts. If you need the result stored, then the triggered script approach is probably your best option.

          • 2. Re: Age recalculation issue

            Thanks PhilModJunk, but by "unstored" do you mean we should be using it as a variable which we discard and recalc for the next client as compared to having a calculated field in the database?

            • 3. Re: Age recalculation issue


              1. Open Manage | Database | Fields
              2. Find your calculation field, if it's a data field with an auto-entered calculation, change it to a calculation field.
              3. Double click the field definition to bring up the calculation expression
              4. Click the storage options... button
              5. Change storage to Unstored


              To keep any calculation fields that refer to Get ( CurrentDate ) up to date, make them unstored calculations if at all possible.

              • 4. Re: Age recalculation issue

                I don't have an "unstored" option on the Storage tab ???

                I do have the field currently set as "auto-entered calculated value" and if I deselect this and on the validation tab set the field as

                validated by calculation and specify the calculation, which works fine and is

                Let ([
                now =Get ( CurrentDate ) ;
                thisBD= Date ( Month ( dob ) ; Day ( dob ) ; Year ( now ) ) ;
                passed= now < thisBD
                ] ;
                Year (now ) - Year ( dob ) - passed

                There is still no "unstored" option on the storage tab.  I only have Global Storage, Repeating and Indexing sections on this tab.


                Can I trouble you to suggest what I am doing wrong?

                • 5. Re: Age recalculation issue

                  Regular fields set to auto-entered calculations cannot update when based upon most Get() functions or on related fields.  You must set up a CALCULATION type instead and specify it to be 'unstored' as explained.

                  • 6. Re: Age recalculation issue

                    Sorry, the bit I was forgetting was to change the field format from numeric to calculated.  Doh!