**
Mark,

Assuming words are defined by separating spaces, the third word will be the text that is between the 2nd space and the 3rd space.  If there could be leading spaces, LTRIM them off.  If there's a chance there won't be at least three spaces, tack one on the end for good measure ($D$ = $D$ + " ").  Then, if $D$ is your description field, you can get the third word by slicing and dicing the string as follows.  

Everything after the first space:
        Action 1:  Char1 = SUBSTRC($D$, STRSTRC($D$,  " ") + 1)
Everything after the second space:
        Action 2:  Char2 = SUBSTR($Char1$, STRSTRC($Char1$,  " ") + 1)
The word between the second and third spaces:
        Action 3:  ThirdWord = SUBSTRC($Char2$, 0, STRSTRC($Char2$,  " ") - 1)

Or skip any temporary fields and do it all in one ugly set field action:
        Action 1:  ThirdWord = SUBSTRC(SUBSTR(SUBSTRC($D$, STRSTRC($D$,  " ") + 1), STRSTRC(SUBSTRC($D$, STRSTRC($D$,  " ") + 1),  " ") + 1), 0, STRSTRC(SUBSTR(SUBSTRC($D$, STRSTRC($D$,  " ") + 1), STRSTRC(SUBSTRC($D$, STRSTRC($D$,  " ") + 1),  " ") + 1),  " ") - 1)

That should do the trick.

Thad Esser
Remedy Developer



From: "Brittain, Mark" <[email protected]>
To: [email protected]
Date: 03/26/2010 01:16 PM
Subject: SUBSTRC on the third word
Sent by: "Action Request System discussion list(ARSList)" <[email protected]>





**
HI All
 
I have a situation where I need to grab the third word from a description. I was able to do  SUBSTRC($Description$, 12, 16) when the first three words were always the same length. However now that “third word” might be 6 characters long instead of 5.
 
Have a great weekend
 
Mark
 
____________________________________________
Mark Brittain
Remedy Developer

NaviSite

[email protected]
(315) 453-2912 x5335 (Phone)

(315) 317.2897 (Cell)
 

  ________________________________  
This e-mail is the property of NaviSite, Inc. It is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential, or otherwise protected from disclosure. Distribution or copying of this e-mail, or the information contained herein, to anyone other than the intended recipient is prohibited.
_attend WWRUG10 www.wwrug.com ARSlist: "Where the Answers Are"_

*IMPORTANT NOTICE: This communication, including any attachment, contains information that may be confidential or privileged, and is intended solely for the entity or individual to whom it is addressed. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message is strictly prohibited. Nothing in this email, including any attachment, is intended to be a legally binding signature. *

_attend WWRUG10 www.wwrug.com ARSlist: "Where the Answers Are"_

Reply via email to