Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

previous year dates 2

Status
Not open for further replies.

Oona8

Technical User
Apr 3, 2002
25
FR
Hi, I'm using CR 8.0. I'd like to get a formula that would allow me to get the following result:

"01.01.2001 to 12.31.2001"

if the report is published in 2002.
Basically I need last year dates, always first day to last day.

How can I do this? It's a bit different from year to date as I always wanna have the same dates whenever I print the report.

Hope someone can help

Cheers
 
{DateField} in Date(2001,1,1) to Date(2001,12,31) should work fine for this. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
I also have a similar problem
I cannot hard code the dates
the date field is the vouchdt
in place of 2001,1,, 1 I tried date({@YEAR},04,01)
in place 2001.12,31 I tried date (year({PPFTXN.VOUCHDT}),03,31)

When i triedthe above in place of below hard coding
{DateField} in Date(2001,1,1) to Date(2001,12,31)
the formula was error free but only a boolean was printed


pls help me also



 
Hi Oona8,

If you want to run the report for different years you might try prompting the user for the year to report on using a parameter field called something like ReportYr that is value type "number".
Next create a formula field called something like VoucherYr with the following formula:

Year ({Vouchdt})

Then select your records if VoucherYr = ReportYr

Best of Luck,

bill
 
This is for Kalpsv,

If your date ranges are always for April (04) to March (03) then you might try treating these dates as a fiscal year and use the following:

Create a formula with a name something like FsYr to assign a fiscal year to each record then prompt for the fiscal year to report. Use the select expert to select records if
@FsYr = ?PromptYr. The formula for FsYr could like this:

If DatePart (&quot;M&quot;,{vouchdt}) < 04 then
DatePart (&quot;YYYY&quot;,{vouchdt}) else
DatePart (&quot;YYYY&quot;,{vouchdt}) + 1

The formula looks at month to calculate the fiscal year. If the month is less that 4 (jan/mar), then the fiscal year is the year of the date. Else add one to the year of the date (april/dec).
 
Hi !

This is for Oona8.

It is something like MrBillSC´s approach.

But if you don´t use a parameterfield you can put this one in your Record selection formula:
Year({your.datefield}) = Year(CurrentDate)-1

And if you want the period printed on your report you can write like this in a formula:
'01.01.' + ToText(Year(CurrentDate)-1,0,&quot;&quot;) + ' to 12.31.' + ToText(Year(CurrentDate)-1,0,&quot;&quot;)

/Goran
 
i tried your formula
but i am unable to get the data of {subscription}
If DatePart (&quot;M&quot;,{vouchdt}) < 04 then
DatePart (&quot;YYYY&quot;,{vouchdt}) else
DatePart (&quot;YYYY&quot;,{vouchdt}) + 1

then {subscription}

gaave me 0 instead of the previous years data



 
Hi !
This is for Kalpsv.

If I understand you wright you always want the records from the last whole period (yy0401-yy0331).
If it is so you can try to put this in your Record Selection Formula:

if Month(CurrentDate >= 4 then
{PPFTXN.VOUCHDT} in Date(Year(CurrentDate)-1,04,01) to Date(Year(CurrentDate),03,31)
else
{PPFTXN.VOUCHDT} in Date(Year(CurrentDate)-2,04,01) to Date(Year(CurrentDate)-1,03,31)

Hope this can help you.

/Goran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top