Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
Information Mgmt
New to Lotus
How to buy
Live demos
Technical library
Forums & community
Java™ technology
Open source
SOA and Web services
Web development
My developerWorks
About dW
Submit content

developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum



PreviousPrevious NextNext

Roy Rumaner 1.Dec.03 10:14 AM a Web browser
Domino Designer 6.0.3 Windows XP

I found the original version of this formula on the web a while back and am trying to use it now. I have created a view that is categorized first by Year, then by Month and then by this formula. What happens (which I cannot explain) is that the documents are split at 6:00 PM on Saturday. This results in the same date being categorized in two different weeks.

I don't see how this could be happening so I am asking for your help.

D := @If( Form = "Reply"; @If( @IsAvailable(PostedDate); PostedDate; @Created) ; DeliveredDate );
FirstOfYear := @Date(@Year(D); 1; 1);
LastOfYear := @Date(@Year(D); 12; 31);
ISOFirstDayNum := @Weekday(FirstOfYear);
ISOLastDayNum := @Weekday(LastOfYear);

REM {The first and last ISO week is the first and last ISO week to include Thursday};
IsFirstWeek := 7 - ISOFirstDayNum > 2;
IsLastWeek := 7 - ISOLastDayNum < 4;

REM {The date of the first day of the first ISO week};
ISOFirstDay := @If(IsFirstWeek;
@Adjust(FirstOfYear; 0; 0; 1 - ISOFirstDayNum; 0; 0; 0);
@Adjust(FirstOfYear; 0; 0; 8 - ISOFirstDayNum; 0; 0; 0));

REM {The date of the last day of the last ISO week};
ISOLastDay := @If(IsLastWeek;
@Adjust(LastOfYear; 0; 0; 7 - ISOLastDayNum; 0; 0; 0);
@Adjust(LastOfYear; 0; 0; -ISOLastDayNum; 0; 0; 0));

REM {Date outside ISOFirstDay and ISOlastDay};
REM {are from the previous or next year};
REM {Return the ISO week number and exit};
LastWeekLastYear := (D - @Adjust(FirstOfYear; -1; 0; 0; 0; 0; 0))/60/60/24/7;
AdjustLastWeek := 1 - (LastWeekLastYear - @Integer(LastWeekLastYear));
@Set("LastWeekLastYear"; LastWeekLastYear + AdjustLastWeek);

REM {If you get this far, the date falls into an ISO week this year};
REM {Convert the difference in seconds to weeks};
NumWeeks := (D - ISOFirstDay)/60/60/24/7;

REM {Fractions indicate that the date falls in the middle of the ISO week};
WeekAdjust := 1 - (NumWeeks - @Integer(NumWeeks));
ISOWeekNum := NumWeeks + WeekAdjust;
"Week " + @Text ( Pad+@Text(ISOWeekNum))

If anyone has any ideas, please post them. I am trying to create a view that is categorized by Year, Month, Week Number and then Day within the Week.

Thank you

Need help with a formula - one thin... (Roy Rumaner 1.Dec.03)
. . great! eom> (Alan P Smith 1.Dec.03)
. . RE: Need help with a formula - one ... (Alan P Smith 1.Dec.03)
. . . . RE: Need help with a formula - one ... (Roy Rumaner 1.Dec.03)

  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds


Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds


IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite