4 Replies Latest reply on May 5, 2009 3:40 AM by KIDO

    Status Date

    dinora

      Title

      Status Date

      Post

      I have a field where I manually update the status of this field to pending, completed, invoiced etc

       

      What I want is a date field that updates automatically when I update the status -  So while I know a modified field will display when a record is modified what I want is field that will show the modification date when the status field is modified.

       

      Can you help?

        • 1. Re: Status Date
          mrvodka
            

          Create a date field with an Auto-entry calc of:

          Case ( not isEmpty ( Status ); Get (CurrentDate) )

           

          Make sure that the  'Do not replace existing value' is UNCHECKED.

          • 2. Re: Status Date
            KIDO
              

            Hi Dinora

             

            I am Portuguese and live in UK.

            The solution to your issue is quite simple. Create a date field and define it in Auto-Enter as Modification - DATE. You only need to check the box  and select the option "Date".

            Every time a record is modified, the datefield will be automaticly updated.

             

            I hope this suits you.

             

            KIDO

            • 3. Re: Status Date
              mrvodka
                

              Dinora knows this already and that is not what is wanted.

               

              Dinora said:

              "So while I know a modified field will display when a record is modified what I want is field that will show the modification date when the status field is modified"

              • 4. Re: Status Date
                KIDO
                  

                Thank you mr_vodka, I must overlooked Dinora's request and I apologize her for that.

                 

                Nevertheless, I have 2 approach to the Status Date issue, depending on FM version and development preferences:

                 

                The simplest approach is to create a date field with a Auto-Enter calculation like this: 

                                               

                                                                                        Evaluate("Get(CurrentDate)"; [SatusField])

                 

                Every time the StatusField is changed, the date field is evaluated and updated. For testing purpose I would create a timestamp field instead and use the expression Evaluate("Get(CurrentTimeStamp)"; [StatusField]). After testing, you only need to change the timestamp field type to date type to keep only dates in records. The evaluation result is not affected by this change.

                 

                For FM 10 users that fancy SCRIPT triggers like me, the following approach also works:

                 

                Select your Status field and setup the Script Triggers

                 

                OnObjectEntry script "OldStatus"

                                                                   Set Variabel [$$oldstatus; Value: Your_StatusField]

                 

                OnObjectExit script "NewStatus"

                                                                    If [ Your_StatusField<!-- [if gte mso 9]><xml> <w:WordDocument>   <w:View>Normal</w:View>   <w:Zoom>0</w:Zoom>   <w:PunctuationKerning/>   <w:ValidateAgainstSchemas/>   <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>   <w:IgnoreMixedContent>false</w:IgnoreMixedContent>   <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>   <w:Compatibility>    <w:BreakWrappedTables/>    <w:SnapToGridInCell/>    <w:WrapTextWithPunct/>    <w:UseAsianBreakRules/>    <w:DontGrowAutofit/>   </w:Compatibility>   <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif] --><!-- [if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif] --><!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal      {mso-style-parent:"";      margin:0cm;      margin-bottom:.0001pt;      mso-pagination:widow-orphan;      font-size:12.0pt;      font-family:"Times New Roman";      mso-fareast-font-family:"Times New Roman";      mso-ansi-language:EN-GB;} @page Section1      {size:595.3pt 841.9pt;      margin:72.0pt 90.0pt 72.0pt 90.0pt;      mso-header-margin:35.4pt;      mso-footer-margin:35.4pt;      mso-paper-source:0;} div.Section1      {page:Section1;} --><!-- [if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable      {mso-style-name:"Table Normal";      mso-tstyle-rowband-size:0;      mso-tstyle-colband-size:0;      mso-style-noshow:yes;      mso-style-parent:"";      mso-padding-alt:0cm 5.4pt 0cm 5.4pt;      mso-para-margin:0cm;      mso-para-margin-bottom:.0001pt;      mso-pagination:widow-orphan;      font-size:10.0pt;      font-family:"Times New Roman";      mso-ansi-language:#0400;      mso-fareast-language:#0400;      mso-bidi-language:#0400;} </style> <![endif] --> ≠ $$oldstatus ]

                                                                    

                                                                        Set Field [ Your_Date_Field ; Get( CurrentDate) ]

                 

                                                                    Endif

                 

                I hope this will sort you out

                 

                KIDO