Jump to content

This topic is 5698 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Im having trouble inserting a date range and need some help.

I have a Word Order Due Date = 7/23/09

I created a report to see all my work orders by week so im able to get the field "work Orer due date" and turn it into Week of year which for the date of 7/23/09 is Week of year "30"

Unfortunately this number 30 doesn't mean a whole lot to a lot of people here so ist here a way to get a date range based on the Work order Due date OR the Week of year?

If possible i would like to have "7/20/2009-7/24/2009" OR week of "7/20/2009"

Any way of doing this..

thanks

Posted (edited)

This is what i have for my week..

BUT my challenge is to be able to show the "Week of" that Monday of my "Week of year"

So in this case i would want to see "Week of 7/20/2009) Instead of Week 30

Hope this makes sense

1.jpg

Edited by Guest
Posted


Let ([



   firstDayOfYear = GetAsNumber ( Date ( 1; 1; Year ( Get ( CurrentDate ) ) ) );

   firstDayOfTheWeek = DayOfWeek ( firstDayOfYear );

   weekOfYear = WeekOfYear ( date )



];



   GetAsDate ( firstDayOfYear + ( weekOfYear * 7 ) - firstDayOfTheWeek - 6 )

   & " - " &

   GetAsDate ( firstDayOfYear + ( weekOfYear * 7 ) - firstDayOfTheWeek )



)

Dates are stored internally in FileMaker as the number of days since 1/1/0001. So, this is what my formula does. It gets the number of days between 1/1/0001 and the first day of the current year which is 733408 this year.

Then, I take your week number ( minus 1 ) times seven and add that to the first day of the year. This will return the number of the day of the week that was also the first day of the year. For example, the first day of the year this year was Thursday so it returns 733611 which corresponds with 7/23/2009 or Thursday of weekOfYear. Then, I subtract the DayOfWeek number and either add one or seven to get a Sunday through Saturday range. You can play with these numbers a bit if you want a different range.

weekOfYear.fp7.zip

Posted

I saw your note about formatting after I posted that. Here is the code to display Week of and the Monday of the week:


Let ([



   firstDayOfYear = GetAsNumber ( Date ( 1; 1; Year ( Get ( CurrentDate ) ) ) );

   firstDayOfTheWeek = DayOfWeek ( firstDayOfYear );

   weekOfYear = WeekOfYear ( date ) - 1



];



   "Week of " & GetAsDate ( firstDayOfYear + ( weekOfYear * 7 ) - firstDayOfTheWeek + 2 )



)

A note about this calculation: You must go to Storage Options... in the calculation dialog and check "Do not store calculation results -- recalculate when needed" since I called the Get ( CurrentDate ) function.

weekOfYear.fp7_2.zip

Posted (edited)

I would handle it like this ... using a pop-up of valid Work Order Dates (but only Sunday's date). Let User select range then find the records for them (see attached). The other problem with WOY is that it can vary. Providing a range works really well.

For display, place a merge field at the top of your form with:

Week beginning: <>

cSundayDate is also used by the value list for Users to select from. Then select the merge field and format the date format to Sunday, August 2, 2009

UPDATE: DOH ... Of course you can search the c calculation itself instead of a range and the range would be +6 instead of +7. That's what happens when one is trying to finish posting when called into a meeting. :tongue2:

Find_Week.zip

Edited by Guest

This topic is 5698 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.