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

Crystal XI formula to shorten text

Status
Not open for further replies.

lorri

Technical User
Oct 4, 2006
61
0
0
US
I have a field that is being pulled that I want to summerize. For example I have one field that pulls a drill down of categories ex)
Server.NetApp Filer
Telecommunications.Account Management

I want to write a formula to stop the text at the second period and group totals by that

Is there a formula to shorten this although it's one field?

Any help is great

Thanks
 
lorri

Try:

left({table.field),InStrRev({table.field},".")-1)

Andy
 
whoops

try

left({table.field},InStrRev({table.field},".")-1)
 
what if I am getting an error that reads string length is less than 0 or not an interger?

If I take out the -1 then it works ok but still leaves on too much text.I only want text.text.

can I do this?
 
lorri,
Another way:

StringVar array txt;
txt := split({table.field}, ".");
txt[1] & "." & txt[2]

Andy
 
that gives me an error a subscript must be between 1 and the size of the array

if I take out the txt 2 it works but shortens it too much....thoughts?

Thanks
 
It sounds like your field doesn't always have a period.

try:

StringVar array txt;
if instr({table.field},".") = 0 then
{table.field}
else
txt := split({table.field}, ".");
txt[1] & "." & txt[2]

Andy
 
now getting an error at the part after else that this array must be subscripted for example array [i
???
can't get it to work....
 
It looks like you need () for the else

StringVar array txt;
if instr({table.field},".") = 0 then
{table.field}
else
(
txt := split({table.field}, ".");
txt[1] & "." & txt[2]
)

Andy
 
when you're good - you're good

Thanks a bunch =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top