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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1st Day of the Month

Status
Not open for further replies.

tmozer

Programmer
Sep 11, 2004
66
US
I am using Crystal Reports 8.5.....

Need a formula to determine the first day of the month from any given day in that month so that I can run a report that spans the first day of the month to the currendate.....
 
Try:

{table.date} in date(year({currentdate}),month(currentdate), 01) to currentdate

-LB
 
Create a date parameter and in the Report->Edit Record Selection->Record place something like:

{table.date} in date(year({?parm}),month({?parm}), 01) to currentdate

Of course you can just use:

{table.date} in {?parm} to currentdate

providing they complete the date parm properly.

-k
 
That worked great. Thanks.....

Now, my report title formula is:

"Commulative Cases/Assignments Received for " + MonthName(month(currentdate)) + " " + totext(int((year(currentdate))))

My year keeps printing as 2,400.00 no matter what I try. What trick am I missing???
 
I use the following in my reports

"Commulative Cases/Assignments Received for " + cstr(currentdate,"MMMM yyyy")
 
To expand on wichitakid's answer, the report is treating the year as if it were an ordinary number. You must have your defaults set to include commas and two decimal places. Check [Fields] on [Options] under [File] on the menu, if you want to change the default values. But note that this can cause trouble if the report is then run on a different machine with other defaults set. Editing output in a formula field is always safer, though it takes longer to code.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Going forward, this is how you resolve text printing of numbers:

"Commulative Cases/Assignments Received for " + MonthName(month(currentdate)) + " " + totext((year(currentdate),0,"")

Note the switches on totext are number of decimal places, and the character to use as the thousands seperator.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top