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

Chop a field that changes in length at a particular character 1

Status
Not open for further replies.

urbanhim

MIS
Jul 11, 2007
154
GB
I need to chop a field which changes in length, but it always needs to be chopped before the third full stop.

So I have a field like this:

AF.DGGTT.OCV.542
AF.DGGTT.OCV.100
AF.DGGTT.OCV.898
BT.GL.DR.GHT.564.561
BT.GL.DR.ABT.G64.L61
BT.GL.DR.BAG.455.122
BT.GL.DR.LRT.FD.VGT
BT.GL.DR.GHT.564.561
BT.GL.DR.GHT.564.561
AND.GRH.HEF.125.588

But what I want to do is create a group for each one before the third full stop:

AF.DGGT.OCV
BT.GL.DR
AND.GRH.HEF


Can this be done? Thank you



UrbanHim
Crystal XI Report Writer
London
[shadeshappy]
[small]What's the best cure for a hangover?... Heavy drinking the night before!![/small]
 
Try this:

stringvar array x := split({table.field},".");
if ubound(x) > 2 then
x[1]+"."+x[2]+"."+x[3] else
{table.field}

You should be able to group on this.

-LB
 
Absolutely brilliant! Works a treat! Thanks

UrbanHim
Crystal XI Report Writer
London
[shadeshappy]
[small]What's the best cure for a hangover?... Heavy drinking the night before!![/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top