on 10-03-2008 4:43 PM
I am a novice with Crystal Reports. I have entered the formula below.
if {InsLine.LineAnnualizedPrem} >= '0' then Maximum ({InsCovTerm.CovTermVersion})
else 0
I am receiving an error when I test the formula. The error is "A number is required here' and the '0' is highlighted. The field is a numeric field (verified in browse field). What is causing this to error. I have the LineAnnualizedPrem as the 3rd sort in the report and it is ouput on the report. Any ideas on why it is requesting the number? Thank you.
Darla,
Right click on Database Fields in the Field Explorer and check show field type. Then check that the field {InsCovTerm.CovTermVersion} is in fact a number. If it isn't you will need to use the tonumber function to convert it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sastry,
I am now receiving and error A number, current amount, boolean, date, time, date-time, or string is expected here. It is highlighting the 'x' prior to :=tonumber
{InsPolicy.PolExpDate} > DateTime (2008, 09, 01, 00, 00, 00) and
{Entities_BCO.EntLookup} = "enco" and
{CdPolLineType_LOB.CdPolLineTypeCode} in ["home", "rent"] and
if not isnull({InsLine.LineAnnualizedPrem}) and {InsLine.LineAnnualizedPrem} >= 0 then
x:=tonumber(Maximum({InsCovTerm.CovTermVersion})) else
x:=0
Sastry, How do you initialize the numbervar?
This is my entire record selection formula
{InsPolicy.PolExpDate} > DateTime (2008, 09, 01, 00, 00, 00) and
{Entities_BCO.EntLookup} = "enco" and
{CdPolLineType_LOB.CdPolLineTypeCode} in ["home", "rent"] and
Numbervar x;
if not isnull({InsLine.LineAnnualizedPrem}) and {InsLine.LineAnnualizedPrem} >= 0 then
x:=tonumber(Maximum({InsCovTerm.CovTermVersion})) else
x:=0
When i check the formula I receive a error "A boolean is required here.". It highlights the Numbervar x; line.
Thank you for your help!
Hi Darla..
When I reply in my previous post, I thought that this code you are using in a formula and not in record selection.
Darla, In Record Selection you can't use Maximum/Min/sum/ etc.(Aggregate functions).
So, please keep the following code in Record Selection.
{InsPolicy.PolExpDate} > DateTime (2008, 09, 01, 00, 00, 00) and
{Entities_BCO.EntLookup} = "enco" and
{CdPolLineType_LOB.CdPolLineTypeCode} in \"home\", \"rent\"
Now go in Formula fields and create a new formula and paste the following :
If not isnull({InsLine.LineAnnualizedPrem}) and {InsLine.LineAnnualizedPrem} >= 0 then
Maximum({InsCovTerm.CovTermVersion}) else 0
Then place this formula in your report and go in Section expert and write suppress condition
Hope this will help you.
Regards,
Sastry
Hi Darla,
If this field({InsLine.LineAnnualizedPrem} ) is a numeric field and if you are comparing it with the 0 values then u can remove the single quotes.
if {InsLine.LineAnnualizedPrem} >= 0 then Maximum{InsCovTerm.CovTermVersion}) else 0
Also the next field {InsCovTerm.CovTermVersion}should be a number other wise you need to convert it to numeric filed using the tonumber function.
I hope this helps you.
Regards,
Prashant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.