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

CR 8.5 Creating Group from numeric DB field

Status
Not open for further replies.

ba4crm

Technical User
Dec 19, 2003
92
US
Hi,
Using CR 8.5: I am trying to create a group and want the group name to display the contents of a DB field. If this field is blank, I want the group name to display "Blank". The DB field that I want to create the group from is a numeric field. So far, I have a formula for a variable name:
numberVar ProvType := {CTCT.Z_PROVTYPE};

When I create the group, I am using formula to get the name of the group. How can I get my report to display "blank" if the CTC.Z_PROTYPE field is blank?

Thanks
 
Blank is different from null, which is different from zero.

The following allows for zero or null:

Just group by the field.

Now for display purposes, use this formula:

if isnull({CTCT.Z_PROVTYPE})
or
{CTCT.Z_PROVTYPE} = 0 then
"Blank"
else
totoext({CTCT.Z_PROVTYPE}},0,"")

-k
 
Dear Ba4crm,

Another option, that I like is to use the Group Customization Capabilities:

Insert Group/Choose Field

Click, Customize Group Name
Click Use a formula radio button and the X-2 formula editor button.

Now, enter SV's formula in the resulting formula editor.

What's the difference between grouping on one field and using the group name customization? Well, the answer is that when you use the group name customization capabilities the Group Tree pane displays the name of the value, the Group prints your requested value without having to have a separate field, and in simple charts (group charts) you will see the value you assign displayed.

Regards,

ro

Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
When writing formulas, note that any test for null must always come first. Without isnull, Crystal will stop processing the formula when it hits a null value; the default assumption being that null means show nothing. I made this mistake several times while I was learning Crystal, because it's not obvious to someone who's used to other programming languages.

Madawc Williams (East Anglia)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top