?
Solved

Crystal Reports 2008

Posted on 2011-10-03
2
Medium Priority
?
263 Views
Last Modified: 2012-05-12
I am trying to create a report using Crystal Reports 2008 and a stored procedure in SQL 2008.
For my end result, I want the loans grouped by:
1.Lien Position
a.1st
b.2nd
then by:
2.@Adjustable
a.Fixed Rate
b.Balloon/Hybrid
c.Adjustable Rate (<= 1yr)
d.Adjustable Rate(> 1yr)
Then by:
3.@Type
a.> 15yrs
b.<= 15yrs
c.> 5yrs
d.<= 5yrs
Part of the report should look like this:
                                                    # of loans             Amount
First Mortgages
      Fixed Rate
                               >15yrs                  500            50,000,000
                               15 yrs or less      1,000        60,000,000
      Balloon/Hybrid
                                 >5yrs                  10               500,000
                                  5 yrs or less     50              1,000,000
      Adjustable Rate
                              1yr or less            20              2,000,000
                             >1 yr                       100            10,000,000
Other Real Estate (2nd liens)
      Closed End Fixed                      400            10,000,000
TOTAL                                                 2,080      133,500,000

Here is the code that I have for @Adjustable:
iif({stored procedure;1.LienPosition}="1",iif(isnull({stored procedure;1.BalloonPayDate}),iif({stored procedure;1.LoanPayType}="F","Fixed Rate",
iif({@DaystoRateChange}=0,"Other",
iif({@DaystoRateChange}<=12,"Adjustable Rate 1 yr or less","Adjustable Rate > 1 yr"))),"Balloon/Hybrid"),
iif(isnull({stored procedure;1.FirstRateChangeDate}),"Closed-end Fixed Rate",""))
@DaystoRateChange code:
iif(isnull({stored procedure;1.FirstRateChangeDate}),0,
iif({stored procedure;1.FirstRateChangeDate}<=CurrentDate,
{stored procedure;1.MthsBetweenChg},datediff("m",cdate({stored procedure;1.OpenedDate}),
{stored procedure;1.FirstRateChangeDate})))

@Type code:
  iif({@Adjustable}= "Fixed Rate",iif({@YrsToMaturity}>15,">15 Years","15 Years or less"),
iif({@Adjustable}="Balloon/Hybrid",iif({stored procedure;1.LienPosition}="1","> 5 Years",
iif({@YrsToMaturity}>5,"> 5 Years","5 Years or less")),""))

The results I am getting are only two loans that fall in the fixed rate category, which is incorrect.
 Majority of the loans should fall under 1st lien fixed rate.Then some fall under
Adjustable Rate > 1 yr and the rest fall under “Other” which is also not correct. I am inserting
groups for Lien position, Adjustable and Type and specify an order within the groups.  Any help
 would be greatly appreciated.  I am not too familiar with Crystal Reports would appreciate
your help.
0
Comment
Question by:moni81011
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 36904702
The way you are using IIF makes it very difficult to follow.

It would be easier if you wrote it with an IF THEN ELSE

I assme you have LienPosition as a 1 or 2.  As written all 2s are "" or Closed-end Fixed Rate which aren't among the listed choices.

I believe I converted this correctly

 
if {stored procedure;1.LienPosition}="1"  then
    if isnull({stored procedure;1.BalloonPayDate}) then
        if  {stored procedure;1.LoanPayType}="F"  then
           "Fixed Rate",
        Else IF {@DaystoRateChange}=0  then
           "Other",
        Else If {@DaystoRateChange}<=12 then
           "Adjustable Rate 1 yr or less",
        Else 
           "Adjustable Rate > 1 yr
    Else 
        Balloon/Hybrid"
Else If isnull({stored procedure;1.FirstRateChangeDate}) then
     "Closed-end Fixed Rate",
Else
      "";

Open in new window



In English
If it is a first (1) mortgage then
    If it doesn't have a balloon date then
          If it type F then
                report FIXED
          Else  if the days to the next change is 0
               report OTHER
          Else if the days to change <= 12 then
               report ADJUATABLE 1 YR OR LESS
          Else
               report ADJUATABLE 1 YR OR MORE
     Else
        report BALLON/HYBRID
Else ( type 2 2nd mortgage)
     If it doesn't have a balloon date then
            report CLOSED-END FIXED RATE
     Else
            report ""

does that sound correct.  

mlmcc


 
0
 

Author Closing Comment

by:moni81011
ID: 36905582
This worked perfectly!!!
I did not write the initial code and you are right, it is a bit hard to understand.  I will try to use the IF THEN ELSE from now on.
Thank you soooooooooooooo much for your help!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question