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!

ABOUT YEARTODATE

Status
Not open for further replies.

raghu55

Technical User
Oct 2, 2005
45
US
hello all,

I am using crystalreports9 and oracle 10g.
I am little confused with ytd/latyearytd.
Below iam giveing all the details,please look on that

report run for monthly.

parameters: start date, end date
groupby: doe_id
sortby: tot_amt_ytd
database field is: di_amt.

reportcolumns: selection/derivation
1)tot_amt_ytd select if loan_type in
(sf,su) for current year
ytd ending on to date.


2)tot_amt_org select if loan_type in
(sf,su)for previous month.


i have a formula fields like:
1)from date:
if {?start-date} = date(1900,01,01) then

minimum(LastFullMonth)
else
{?start-date}

2)to date:
if (?end date) = date(1900,01,31) then
maximum(LastFullMonth)
else
(?enddate}

3)select by range:
if {?start-date} = date(1900,01,01) then
{TABLE.DATE} in LastFullMonth
else
{table date} in {?start-date} to {?end-date}

my question is when i run the report using default parameters it should give tot_ytd_amt from starting of the year to enddate.

ex: if i run the report today it should give tot_ytd_amt from jan 1 2006 to mar 31 2006.

if i run the report, jan 2 2006 it should give last year tot_ytd_amt i.e(jan 1 2005 to dec 31 2005).


for second field tot_amt_org
it should give amt for lastfull month.
i.e only for (mar 1 2006 to mar 31 2006)

when i run the report jan 2 2006
it should give tot_amt for the month (dec 1 2005 to dec 31 2005).

help requested...






 
Where are these formulas? They don't seem correct to me.

Anyway, if you just post what yo want the default to return, this will be simpler.

If you run a report using yeartodate on Jan 2, 06, you'll get Jan 1 and 2.

Then you use lastfullmonth and state that you expect the year to date??? You should be using yeartodate if that's the case, your post is somewhat confusing.

-k
 
Crystal will give you whole years, e.g. Year(currentdate) or Year({TABLE.DATE}). Also check what you can do with Month and DatePart.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
if {?start-date}=date(1900,01,01) then

(if month(currentdate)<>1 then
{LOAN.GUARANTEE_DATE} >= minimum(yeartodate)
and
{LOAN.GUARANTEE_DATE} <= maximum(lastfullmonth)
else
{LOAN.GUARANTEE_DATE} in dateserial(year(currentdate)-1,1,1) to
dateserial(year(currentdate)-1,12,31)
and {LOAN.GUARANTEE_DATE} <= maximum(lastfullmonth))

else (if {LOAN.GUARANTEE_DATE}in{?start-date} to{?end-date} then

if month(currentdate)<>1 then
{LOAN.GUARANTEE_DATE} >= minimum(yeartodate)
and
{LOAN.GUARANTEE_DATE} <= {?end-date}
else
{LOAN.GUARANTEE_DATE} in dateserial(year(currentdate)-1,1,1) to
dateserial(year(currentdate)-1,12,31)
and
{LOAN.GUARANTEE_DATE} <={?end-date})

please explain in clearly about this formula.

thank you.
 
I suggest you split the formula into a number of boolians, tests without an 'if' that will return True or False. Use them on a test report and see what's working. See if it will work better by getting the year-value directly.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top