3 Replies Latest reply on Jul 2, 2014 7:27 AM by philmodjunk

    Script Help - Change X when date X exceeded

    ChristofferRexen_1

      Title

      Script Help - Change X when date X exceeded

      Post

           Hello everyone

           All new to FileMaker Pro Advanced, but i'm catching up pretty good I think..

            

           I have this database, see attached image.

           I would like the field "Status" to place an X within one of the tree boxes under Status: "Tilmeldt", "Afmeldt", "Barn", if a person, in this case "John Doe", is employed or not. Furthermore I would like the field "Status" to update whenever a new entry has been made and then re-set the X in the correct box, let's say he gets re-employed.

           I got this far with the script, but am i'm missing something, the field is "Unstored".

           Case ( Resigned  ≥ Get ( CurrentTimeStamp ) ; Status = "Afmeldt" ; Resigned   ≤ Get ( CurrentTimeStamp ) ; Status = "TIlmeldt" ;
           "" )
            
           Thanks in advance.
           CR

      Sk%C3%A6rmbillede_2014-07-02_kl._09.56.24_kopi.jpg

        • 1. Re: Script Help - Change X when date X exceeded
          philmodjunk
               Case ( Resigned  ≥ Get ( CurrentTimeStamp ) ;  "Afmeldt" ; Resigned   ≤ Get ( CurrentTimeStamp ) ; "TIlmeldt"  )
                
               This must be defined as the calculation for the field "status" or assigned via script by using this as the calculated result part of a set field step.
                
               status = "Afmeldt" is a Boolean expression that will return the value 1 (True) if the two parts are equal and 0 (false) if they are not.
          • 2. Re: Script Help - Change X when date X exceeded
            ChristofferRexen_1

                 Hi Phil

                 I'm not sure I'm with you here? (New at FileMaker)

                 I take my existing Case function and replace it with you're Case function.

                 Although I have to make the field "Status" a calculation first?

                 I'm not sure if I got the whole thing with here.

                 When entering a new employe in the Database, the field "Status" ; "Tilmeldt" will get an X by default, if the field "Signed" is the same date/exceeds current date.

                 At the same time, "Status" will have to look at the field "Resigned" and check if the specific date "Resigned" is the the same date/exceeds current date.

                 By changing existing X from "Tilmeldt" to "Afmeldt" and vice-versa, so there's only one X pr. employe record.

                  

                 I hope it makes sense.

            • 3. Re: Script Help - Change X when date X exceeded
              philmodjunk

                   Status will need to be one of the following:

                     
              1.           a calculation field. With this option, the field can no longer be edited directly. That may or may not be a problem.
              2.      
              3.           a text field with an auto-enter calculation. I can be possible to still directly edit the field.
              4.      
              5.           A text field updated with a script performed by a script trigger whenever you modify the value of the resigned field. This option works, but only on layouts where you set up such a script trigger and is needlessly complex unless it, for some reason, is the only option that works for you.