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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula to suppress a section conditionally

Status
Not open for further replies.
Aug 27, 2003
428
0
0
US
Hi,

I am using Crystal Reports with VB Dot Net. I have a section with a double line. I need to suppress the double line conditionally based on the value of a field.

I tried the formula as

not ({Detail.HoldBack} <> 0) but this did not work. I also tried ({Detail.HoldBack} <> 0) but this did not work either.

When the field Detail.HoldBack is set to 1, I want to suppress teh section containing the double line. Else I want to show the double line.
 
I missed the last line. No errors now.

Regarding the conditions to display:

Value = NULL (Display)
Value >= 0 (Suppress)

So then let me change the last line to the below and test again.

Holdback >= 0 or LehmanHoldBack >= 0 or Interest >= 0


WhilePrintingRecords;
Local NumberVar HoldBack := If IsNull({Detail.HoldBack}) Then 0 Else {Detail.HoldBack};
Local NumberVar LehmanHoldBack := If IsNull({Detail.LehmanHoldBack}) Then 0 Else {Detail.LehmanHoldBack};
Local NumberVar Interest := If IsNull({Detail.Interest}) Then 0 Else {Detail.Interest};

Thanks,
junction123
 
I ran it for the case where the values are not set but it still suppresses the section.

I feel the set up does not know how to identify nulls, I will have to check this. When the values are set to any number, the section is suppressed which is fine.

But when the values are not set, still suppresses the section.

I am not sure whether it is the formula or whether it is the set up for the field in that it does not recognize nulls?

Thanks again for your help,
junction123
 
Please look in file->report options and report back on whether you have anything checked for "convert nulls to default values".

-LB
 
No I do not have it checked.

There is an option Convert Other NULL Values to Default and this is unchecked.

Thanks,
junction123
 
I have sample values for Interest and LehmanHoldBack from users as
0.30 and 525.00. So the values expected are of type float. Itried changing teh formula to check for >= 0.00 but this did not help either.

Thanks,
junction123
 
The default value for all three fields is not null. Then checking for null values defeats the purpose?

Can I use something like this instead? Where we do not check for isnull since the default is not null and just check for a real number value?

not ({Detail.HoldBack} >= 0) and
not ({Detail.LehmanHoldBack} >= 0) and
not ({Detail.Interest} >= 0)

Thanks,
junction123
 
I tried entering a value of null and just blank spaces and I get a error saying that value must be a number.

So the formula should check for number values entered and if yes then do nto show the section.

I am not sure how to go about cheking this.

Thanks,
junction123
 
The field also allows a value of 0 and negative numbers. I just tried entering -1 and it accepted the value.
 
Try this

Not(IsNull({Detail.HoldBack}))
or
Not(IsNull({Detail.LehmansHoldBack}))
or
Not(IsNull({Detail.Interest}))

Gary Parker
MIS Data Analyst
Manchester, England
 
Remind us what section the lines are in. Then also insert the fields you are using for suppression in the section and report back with sample data.

-LB
 
if you want to check and suppress all numbers, try this formula in your Suppress X+1 area:

isnumeric({Table.Field})=TRUE
 
I had to insert a new section with just the double line because the double line existed in a section that had a field value which had to be displayed unconditionally.

So I took out the double line and inserted a new section.

I tried the below formula:

not ({Detail.HoldBack} < 0 or {Detail.HoldBack} >= 0) and
not ({Detail.LehmanHoldBack} < 0 or {Detail.LehmanHoldBack} >= 0) and
not ({Detail.Interest} < 0 or {Detail.Interest} >= 0)


When I do not set any value, the section containing the double line is not displayed.

I get an error "String is required here" when I use the below formula

isnumeric({Table.Field})=TRUE

I will try the other suggested formula as well.

Thanks again for your help!

junction123
 
When I change the formula to below, I do not get any errors but I am not sure whether this is correct?

isnumeric("{Detail.HoldBack}")=TRUE


Thanks,
junction123
 
I ran the report to show the values.

HoldBack appears as 1.00
Interest appears as 0.00
xyzHoldBack appears as 0.00



Thanks,
junction123
 
Oops said it too early. I still do not see the section when the values are not set.

When the values are set this works perfect, but not for the case teh values are not set.

Makes no sense to me.

Thanks,
junction123
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top