cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a variable Group Header Field

Former Member
0 Kudos

Post Author: Jodonnell

CA Forum: General

Hey Everyone,

Hopefully this is an easy answer. I am new to crystal reports, I am used to Access. I know a small amount of SQL and primarily use VB. Here is what I am trying to do:

I want to make a field that says that the account "matures under 90 days" or matures between 1 year and 3 years depending on the amount of days remaining to reach maturity which is already a field. Then I can use this field to group accounts correctly. So here is what I am trying with limited success. I am making a formula field that says:

If {@DaystoMature} < 91 then "Matures within 3 Months" else If {@DaystoMature} > 90 and < 366 then "Matures between 3 Months and 1 Year"else if {@DaystoMature} > 365 and < 1096 then "Matures between 1 year and 3 years"else if {@DaystoMature} > 1095 and < 1826 then "Matures between 3 years and 5 years"else if {@DaystoMature} > 1825 then "Matures over 5 years"

Now if I just have the top line there and remove the bottom 4 than it works and will correctly display the message on accounts that mature in less than 91 days. However if I attempt to add the rest I get errors. How can I make this work properly? Thanks very much for any help that you can offer.

James O'Donnell

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Post Author: Jodonnell

CA Forum: General

Thanks Charliy, your example got me up and running. Thanks a bunch!

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

I use similar formulas all the time and don't see anything wrong with yours. You might try putting a final ELSE "Unexpected Result" at the end.

This one looks just like yours and it works:

if {@age} < 13 then '0 to 12' elseif {@age} in &#91;13 to 17&#93; then '13 to 17' elseif {@age} in &#91;18 to 59&#93; then '18 to 59' elseif {@age} > 59 then '60 & Up'else 'x'