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

Zero valuse listed when report is generated with oracle backend. 1

Status
Not open for further replies.

cyberdyne

Programmer
May 1, 2001
173
IN
Hi all,

I am facing a problem with crystal report 7.0

My application(Made in VB) works fine. Backend is oracle 8.0 and so does the report. But when some fields are not filled with values oracle gives it value as zero '0 '.

Now when this fields are selected in crystal reports they show zero for that value.

I want such solution that if value is zero or no value then that shoul not be displayed along with it's lable. Can any one help me how to do that ?

Thanks

Apoorva
cyberdyne@softhome.net
:-9
 
Assuming this is a numeric field, when you open the Format window by right-clicking on the field, there's a box on the Number tab for "Suppress if Zero."

For the label to the field (assuming it's in the detail section along with the data field), you could create a formula to put on the report instead of the label.

The code for the formula would be:

If {field} <> 0 then &quot;Label you want&quot; else &quot;&quot; Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
(Currently available for consulting in Chicago)
 
thanks buddy ,
i will try it out. but what do i if my fields are of varchar2 type in oracle.( this is a type of field which can hold any characters but they are treated as text.)

Say some fields are like

name varchar2 type
address varchar2 type

now if i dont have a value for some field say name then oracle stores it as zero. and if I run report it shows zero here too for name field. and same is printed too.
I dont want this.

Please help at your earliest.

Thanks

Apoorva
 
If the field is not numeric, then the &quot;Suppress When Zero&quot; option won't be there.

You can set up a similar formula for the name field and place it on the report instead of the name field itself.

You could either convert the name to a number and check to see if it's zero, or trying looking for zero as the string.

For the string way:

if trim({name}) = &quot;0&quot; then &quot;&quot; else {name}

For the number way (and there are probably other ways):

if tonumber({name}) = 0 then &quot;&quot; else {name} Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
(Currently available for consulting in Chicago)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top