Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: select specific values from a string Post Reply Post New Topic
Author Message
lello
Newbie
Newbie


Joined: 12 Nov 2010
Location: Lebanon
Online Status: Offline
Posts: 5
Quote lello Replybullet Topic: select specific values from a string
     Posted: 01 Nov 2011 at 11:03pm
Hi Guys,
 
I am a newbie so bare on me.
 
We have a character field which has values like this:
test/298
testa/15
testab/8
new/39
newbie/444
 
 
I want a function to show me the numberic values only. the second part of the string. 444 or 298 or 39...
 
note that in each string we have the separator "/"
 
Can you please help me to achieve this?
 
Thanks
IP IP Logged
mro01
Newbie
Newbie


Joined: 19 Oct 2011
Online Status: Offline
Posts: 3
Quote mro01 Replybullet Posted: 02 Nov 2011 at 1:42am
perhaps something like that ? define a formula with the following code:

right(strVar, len(strVar) - InStr (1, strVar, "/"));



(strVar is your value)
IP IP Logged
lello
Newbie
Newbie


Joined: 12 Nov 2010
Location: Lebanon
Online Status: Offline
Posts: 5
Quote lello Replybullet Posted: 04 Nov 2011 at 12:16am
Thanks mro01. it worked :D
 
another request please.
Now I want the opposite, I want to display the string but not the number (without the "/" )...
what should be the expression?
 
Thanks
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 04 Nov 2011 at 2:08am
split({table.field},"/")[1]

Also, for the sake of simplicity, the first expression could be:

split({table.field}, "/")[2]


Edited by FrnhtGLI - 04 Nov 2011 at 2:09am
|< /\ '][' ( )
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum