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

Separating a string field into 2 types 2

Status
Not open for further replies.

Halfcan

Technical User
Dec 8, 2002
214
US
Hello, I have one table.field that Contains strings like similar to this:
101C
102C
101N
102N
103C..... in no particular order. There are 2 types of codes. Some with C's and some with N's.

I need to separate the C's from the N's and make graphs for each.
I have a formula where the end result shows either one type or nothing. The problem is When I create a graph, I have a BLANK category being graphed as well. The blank is every record that did not fall into the formulas criteria.

Here's my formula:
@ReasonCodeC
//This reads the Reason Code, and if the 4th character is "C" it shows the code. otherwise it remains blank.
if mid({Tickets.Reason Code},4,1) = 'c' then
{Tickets.Reason Code}
******************

Does anyone know how to Split {Tickets.Reason Code) into 2
separate groups, so I can use them in graphs or crosstabs?

With my crosstabs, I was able to cheat and Checked "Suppress Blank Rows" but I havn't found any options like that in the Chart expert.

Any help would be greatly appreciated. V.85
Thanks
Andy
 
In the chart expert->data, click on {@ReasonCodeC} and then select "Order" and choose specified order. If there aren't too many reason codes, you can then enter each one as a defined group and then select "Other" and discard all others.

If there are a lot of reason codes, you might want to consider creating two subreports and using your formula in the select statements:

{@ReasonCodeC} like "*C"

not ({@ReasonCodeC} like "*C")

Then you can create your graphs in the subreports.

-LB
 
Create a formula {@GroupBy} defined as:
------------------------------
{Tickets.Reason Code}[4]
------------------------------

Then, simply Group the report on that formula.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Excellent ideas! I used lbass's first idea, There are only 10 different codes of each kind, that just specified the order in chart Expert.

Thanks guys,

Andy
 
If you want performance, create a SQL expression containing something like:

substring(Tickets.Reason Code,4,1)

Then Group on this field, the database will do the work for you and hence, the best possible performance.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top