Print Page | Close Window

Extract First Word from a String Value

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8387
Printed Date: 01 May 2024 at 10:39pm


Topic: Extract First Word from a String Value
Posted By: niloc
Subject: Extract First Word from a String Value
Date Posted: 18 Nov 2009 at 3:52am
I need to extract just the first word from a string value in a formula in Crystal Reports XI, but as the first word is variable and also of a varying length I cannot workout how to do this. Can anyone help as the dent in the wall where my head has been hitting it is slowly getting larger!!

Examples:

Fred Bloggs
Freda Bloggs
Joe Bloggings
Joanne Bloggings



Replies:
Posted By: FrnhtGLI
Date Posted: 18 Nov 2009 at 5:08am
split({table.namefield}, " ")[1]
This will give you the first part of a string that is separated by a space.


Posted By: niloc
Date Posted: 18 Nov 2009 at 5:31am
Perfect - thanks for your speedy response :)



Print Page | Close Window