4 Replies Latest reply on Jul 5, 2013 12:21 AM by hrcap

    Auto Enter Start Time

    hrcap

      Title

      Auto Enter Start Time

      Post

           Afternoon All

            

           I have a field titled: monday_start_time this field is so that the user can enter in the time that they started work. The field uses a drop down list containing values such as: 01:00, 01:15, 01:30, 01:45 etc etc. Also included in the list is N/A for use when the user did not work on the monday.

            

           I am currently trying to write an auto entry calculation, here is what i have so far:

            

            

           Let(
            
           @ST = TextFormatRemove (Filter(Self; "0123456789")); 
            
           Case(
            
           Length(@ST) = 4;
            
           Left (@ST; 2) & ":" &
           Right(@ST; 2);
            
           TextColor ( Self ; RGB(255; 0; 0))
            
           )
            
           )
            
           The cluculation at this stage identifies if four number digits have been entered and then either puts the digits into the correct format i.e 00:00 or highlights the digits in red to alert the user that a mistake has been made.
            
           How would i add to this calculation to allow N/A to pass through as a valid entry because currently when N/A is entered it is marked in red.
            
           Many Thanks
            
           Hadleigh

        • 1. Re: Auto Enter Start Time
          raybaudi

               If the field is a TEXT field:

               ...
               Case(
               Self = "N/A" ; Self ;
               Length(@ST) = 4;
               ...
          • 2. Re: Auto Enter Start Time
            hrcap

                 Hi

                 Thanks for your help, i used your info and ended up with the following which is working fine:

                  

                  

                 Let(
                  
                 @ST = TextFormatRemove (Filter(Self; "ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789")); 
                  
                  
                 Case(
                  
                 Get(ActiveFieldContents) = "N/A" ; "N/A"
                  
                 ;
                  
                 Length(@ST) = 4;
                  
                 Left (@ST; 2) & ":" &
                 Right(@ST; 2);
                  
                  
                 TextColor ( Self ; RGB(255; 0; 0))
                  
                 )
                 )
                  
                  
                 cheers
                  
                 Hadleigh
            • 3. Re: Auto Enter Start Time
              raybaudi

                   What is the difference from Self and Get(ActiveFieldContents) ?
                   Also why filter for all alphabet ?

                   Your calc may work but is oversized.

              • 4. Re: Auto Enter Start Time
                hrcap

                     Hi Ray

                     At first i could not get self to work in the format:

                     Self = "N/A" ; Self

                     When this was used it returned the value of 0, i would guess that this is because it is a number field and not a text field. I however adjusted the formula to include self, and have taken out the filter for the entire alphabet as you suggested so the formula now looks like:

                      

                      

                     Let(
                      
                     @ST = TextFormatRemove (Filter(Self; "0123456789")); 
                      
                      
                     Case(
                      
                     Self = "N/A" ; "N/A"
                      
                     ;
                      
                     Self = "na" ; "N/A" 
                      
                     ;
                      
                     Length(@ST) = 4;
                      
                     Left (@ST; 2) & ":" &
                     Right(@ST; 2);
                      
                      
                     TextColor ( Self ; RGB(255; 0; 0))
                      
                     )
                     )
                      
                      
                     Thanks for your help