I have to create a report.
First column is from 1.4 of previous year to 31.3. of
this year.
Next column is from 1.4 of this year to end of previous
month
for all this i am using only two fields
vouchdt yyyy-mm-dd
subscription currency
How about you create a couple of formulas like these:
//Last Year's April to Current Year's March
if {vouchdt} >= date(year(currentdate)-1,4,1) and
{vouchdt} <= date(year(currentdate),3,31)
then {field}
//Current Year's April to End of Last Month
if month(currentdate) in [4,6,9,11]
then
if {vouchdt} >= date(year(currentdate),4,1) and
{vouchdt} <= date(year(currentdate),month
(currentdate)-1,30)
then {field}
else
if month(currentdate) in [5,7,8,10,12]
then
if {vouchdt} >= date(year(currentdate),4,1) and
{vouchdt} <= date(year(currentdate),month(currentdate)-1,31)
then {field}
If your "date" is actually an 8 digit integer in a YYYYMMDD format, try incorporating the NumbertoDate() function. This is available as a download on the crystal decisions website. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
it didnot work:
i typed the following formula the err was " A ) was missing"
near year{ ppftxn.vouchdt} on the first line
if {PPFTXN.VOUCHDT} >= date(year{PPFTXN.VOUCHDT}-1,4,1) and
{PPFTXN.VOUCHDT} <= date(year{PPFTXN.VOUCHDT},3,31)
then {PPFTXN.SUBSCRIPTION}
and then I tried with current date then also it gives the same error
what is meant by current date
Pls help me
if i select a range of dates from VB 1.e. 1.4.2002
to 30.6.2002
then the figure is correct..Thank you
but if I select 1.4.2002 to 30.4.2002 the previous
month figures should be zero (subscription) because
when the report is generated for the month of april
then the figure of last month should not be refklected
because it goes to the previous year figures.
//Current Year's April to End of Last Month
if month({PPFTXN.VOUCHDT}-1) in [4,6,9,11]
then
if {PPFTXN.VOUCHDT} >= date(year({PPFTXN.VOUCHDT}),4,1) and
{PPFTXN.VOUCHDT} <= date (year({PPFTXN.VOUCHDT}),month({PPFTXN.VOUCHDT}-1),30)
then
{@subs}
else
if month({PPFTXN.VOUCHDT})-1 in [1,3,5,7,8,10,12]
then
if {PPFTXN.VOUCHDT} >= date(year({PPFTXN.VOUCHDT}),4,1) and
{PPFTXN.VOUCHDT} <= date (year({PPFTXN.VOUCHDT}),month({PPFTXN.VOUCHDT}-1),31)
then
{@subs}
else
if month({PPFTXN.VOUCHDT})-1 in [2]
then
if {PPFTXN.VOUCHDT} >= date(year({PPFTXN.VOUCHDT}),4,1) and
{PPFTXN.VOUCHDT} <= date (year({PPFTXN.VOUCHDT}),month({PPFTXN.VOUCHDT}-1),28)
then
{@subs}
to Naith
your last year selection formula works fine
thank you for the same
but the data returned is zero
instead of value
the formula used by me is
//FORMULA FOR LAST YEAR
if {PPFTXN.VOUCHDT} in (date(year({PPFTXN.VOUCHDT}-1),04,01)) to
(date (year({PPFTXN.VOUCHDT}),month({PPFTXN.VOUCHDT}),28))
then
{TXN.SUBSCRIPTION}
KINDLY HELP ME SIR
I have to create a report.
First column is from 1.4 of previous year to 31.3. of
this year.
Next column is from 1.4 of this year to end of previous
month
for all this i am using only two fields
vouchdt yyyy-mm-dd
subscription currency
please help me
This was your reply
Naith (Programmer) Jun 12, 2002
How about you create a couple of formulas like these:
//Last Year's April to Current Year's March
if {vouchdt} >= date(year(currentdate)-1,4,1) and
{vouchdt} <= date(year(currentdate),3,31)
then {field}
//Current Year's April to End of Last Month
if month(currentdate) in [4,6,9,11]
then
if {vouchdt} >= date(year(currentdate),4,1) and
{vouchdt} <= date(year(currentdate),month
(currentdate)-1,30)
then {field}
else
if month(currentdate) in [5,7,8,10,12]
then
if {vouchdt} >= date(year(currentdate),4,1) and
{vouchdt} <= date(year(currentdate),month(currentdate)-1,31)
then {field}
That do ya?
Naith
then I had the following problem
if i select a range of dates from VB 1.e. 1.4.2002
to 30.6.2002
then the figure is correct..Thank you
but if I select 1.4.2002 to 30.4.2002 the previous
month figures should be zero (subscription) because
when the report is generated for the month of april
then the figure of last month should not be refklected
because it goes to the previous year figures.
Thanks, but I can already see what you and I first said at the beginning of this thread.
I was more after a copy of your formula as it stands at the moment.
Anyway, from what you've described, can you not put in a handler for April?
i.e. If minimum({?date range parameter}) >= date(year(currentdate),4,1) and maximum({?date range parameter}) <= date(year(currentdate),4,30) then 0
else
[insert formula I gave you].
This is for Naith
I am to have a report from 1st of April to the end of the
previous month i.e. upto March next year.
//Current Year's April to End of Last Month
If minimum({PPFTXN.VOUCHDT}) >= date(year({PPFTXN.VOUCHDT}),04,1) and
maximum({PPFTXN.VOUCHDT}) <= date(year({PPFTXN.VOUCHDT}),04,30) then 0
else
if month({PPFTXN.VOUCHDT}-1) in [6,9,11]
then
if {PPFTXN.VOUCHDT} >= date(year({PPFTXN.VOUCHDT}),04,01) and
{PPFTXN.VOUCHDT} <= date (year({PPFTXN.VOUCHDT}),month({PPFTXN.VOUCHDT}-1),30)
then
{@debits}
else
( if (month({PPFTXN.VOUCHDT}-1) in [1,3,5,7,8,10,12])
then
if ({PPFTXN.VOUCHDT}) >= (date(year({PPFTXN.VOUCHDT}),4,1)) and
({PPFTXN.VOUCHDT}) <= (date (year({PPFTXN.VOUCHDT}),month({PPFTXN.VOUCHDT}-1),31))
then
({@DEBITS}))
else
if month({PPFTXN.VOUCHDT})-1 in [2]
then
if {PPFTXN.VOUCHDT} >= date(year({PPFTXN.VOUCHDT}),4,1) and
{PPFTXN.VOUCHDT} <= date (year({PPFTXN.VOUCHDT}),month({PPFTXN.VOUCHDT}-1),28)
then
{@debits}
The above formula was used as suggested by you. the following problems are faced by me:
1.I am unable to have a subtotal after inserting the first
three lines I.e. min of vouchdt and max of vouchdt.
2. The formula works only for 6,8,10 where no of days
are thirty and for the reminaing 5,7,9 it does give me 0.
3. Am I correct in using the above formula for months 1,2,3.
Can you help me sir. I am suppose to deliver the project mid June and I am stuck with this report.
Why have you replaced all the {currentdate}s with your fieldname? Put currentdate back in.
What do you mean by "The formula works only for 6,8,10 where no of days are thirty". The months which have a maximum of 30 days are 6, 9, and 11. 4's excluded because it's April.
To total these formulas, you'll have to use formulas rather than the summary expert.
e.g.
//Formula1 -- adds up the total (detail section)
whileprintingrecords;
numbervar Sum_Form1;
Sum_Form1 := Sum_Form1 + {@FormulaName};
//Formula2 -- displays the total (group or report footer)
whileprintingrecords;
numbervar Sum_Form1;
//Formula3 -- resets the total (group or report header)
whileprintingrecords;
numbervar Sum_Form1 := 0;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.