7 Replies Latest reply on Feb 28, 2014 9:12 AM by philmodjunk

    Date Formula

    kentanderson

      Title

      Date Formula

      Post

           I need two different formulas  The first one is I need a field to display The previously weeks Monday.  Example  Monday, February, 17, 2014

           The second I'm wanting is to search a date by week.  The user will only enter the Monday date of any wek and the found result will time me Monday - Sunday search result.

        • 1. Re: Date Formula
          philmodjunk

                DateField - DayofWeek ( DateField ) - 5

               If the user enters/selects that Monday date ( and this could be modified to work even if it is not a Monday date) into a field with global storage specified:

               Enter Find Mode []
               Set Field [ YourTable::DateField ; globals::gMonday & "..." globals::gMonday + 6 ]
               Set Error capture [on]
               Perform find []

               this is patterned after the scripted find examples found here: Scripted Find Examples

          • 2. Re: Date Formula
            kentanderson

                 How do i make the First formula work???  Here is what I did.  I created a new Date field I told it to automatically enter date on creation, then i selected calculated value.  Used My field which was getdate.  getdate - day ofweek ( getdate ) - 5   .  I then placed this file on a list view which i am using as a repot.  the file just shows a ?

            • 3. Re: Date Formula
              philmodjunk

                   I assumed that every record in your table already had a date that you wanted and needed to log as the date for that record. This would be a separate calculation field that would compute a date for the Monday of the preceding week by referring to the date in that date field.

              • 4. Re: Date Formula
                kentanderson

                     Here is a example of what i am trying to accomplish.  I need a field that will display the Monday date for the week I am printing.  I have two different ways of printing this info.  One is print last week employee info, and two is select a week to print.  so it may not be last week.  Thank You.  Im lost on how to do this

                • 5. Re: Date Formula
                  philmodjunk

                       What data do you currently have in your table that identifies what week it falls in? In the table shown, don't you have multiple records, each for a different day logging the time spent? Isn't there a date field that records the specific day for which those hours were logged for that client?

                  • 6. Re: Date Formula
                    kentanderson

                         yes there is a date field for each record.  Hope this helps

                    • 7. Re: Date Formula
                      philmodjunk

                           Then the calculation that I have specified can take the date in that left hand column and return the Monday date that you originally specified. But the calculation field is a separate field from the one shown in your layout.

                           Though you don't actually need that calculation to get the results you are showing on your screen shot, you need only do the date range find specified in my original post.