Home
Crystal Reports Training
Crystal Reports XI
Crystal Reports .NET
Crystal Reports Forum
News
Tech Support
Active Topics
Memberlist
Search
Help
Register
Login
Technical Questions
Crystal Reports Forum
:
Crystal Reports 9 through 2022
:
Technical Questions
Topic: Get week number for the month
Author
Message
Elisha83
Groupie
Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
Topic: Get week number for the month
Posted: 22 Sep 2011 at 1:49am
Hi there,
I need help in retrieving week number of the month based on my transaction date. Below is the example of my expected results.
Invoice
Trans. Date
Week
IN001 03/01/2011 2
IN002 31/01/2011 6
IN003 01/02/2011 1
IN004 28/02/2011 5
IN005 06/03/2011 1
IN006 14/03/2011 3
Urgently need help in getting the right formula as I have try a lot of time but could not get the accurate output. Your help is kindly appreciated.
Thanks in advance...
3Lish@
IP Logged
rybad80
Newbie
Joined: 18 Oct 2010
Location: United States
Online Status: Offline
Posts: 7
Posted: 20 Aug 2013 at 5:18am
Try this. It worked for me
shared datevar dtmTargetDate := date({PRE_CASE.START_DATE});
shared datevar dtmStartDate := date({PRE_CASE.START_DATE});
shared numbervar dtmDay := DatePart("d", dtmTargetDate);
shared numbervar dtmMonth := DatePart("m", dtmTargetDate);
shared numbervar dtmYear := DatePart("yyyy", dtmTargetDate);
shared numbervar intWeekday;
shared numbervar intAddon;
shared numbervar intWeek1;
shared numbervar intWeek2;
shared numbervar intWeek3;
shared numbervar intWeek4;
shared numbervar intWeek5;
shared numbervar intWeek6;
shared numbervar numWeek;
intWeekday := Weekday({PRE_CASE.START_DATE});
intAddon := 8 - intWeekday;
intWeek1 := intAddOn;
intWeek2 := intWeek1 + 7;
intWeek3 := intWeek2 + 7;
intWeek4 := intWeek3 + 7;
intWeek5 := intWeek4 + 7;
intWeek6 := intWeek5 + 7;
If dtmDay <= intWeek1 Then
numWeek := 1
Else
If dtmDay <= intWeek2 Then
numWeek := 2
Else
If dtmDay <= intWeek3 Then
numWeek := 3
Else
If dtmDay <= intWeek4 Then
numWeek := 4
Else
If dtmDay <= intWeek5 Then
numWeek := 5
Else
If dtmDay <= intWeek6 Then
numWeek := 6;
numweek;
IP Logged
Printable version
Forum Jump
-- Select Forum --
Announcements
Talk with the Author
Self-Publishing
Job Postings
New feature request
Report Design
Data Connectivity
Technical Questions
Tips and Tricks
Crystal Xcelsius
Report Design
Data Connectivity
Writing Code
Tips and Tricks
Report Design
Data Connectivity
Writing Code
Tips and Tricks
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
delete your posts in this forum
You
cannot
edit your posts in this forum
You
cannot
create polls in this forum
You
cannot
vote in polls in this forum
HOME
|
FREE EBOOK
|
PROGRAMMING GUIDE
|
PURCHASE
|
REVIEWS
|
CONTACT ME
|
FAQ
|
LINKS
|
PRIVACY
|
CLICK PLAYS
|
KONACAD
© 2004-2026 Brian Bischof. All Rights Reserved.