Strip Value To Left Of Character Follow

0
Avatar
Legacy Poster

I have a database field with some values of x/.  As an example 3/3.99.  I am looking for a VB script to strip out the 3/ leaving me 3.99.

i.e. 2/5.99 I want 5.99.  I was hoping to somehow remove everything to the left of the / including the /.

Any ideas?

3 comments

0
Avatar
Shotaro Ito
Comment actions Permalink

For BarTender 10.0 or later, that's easy..
on the data source's Transforms tab > search and replace, add 2 actions.

1. Search and Delete Everything Before: "/"

2. Search and Delete: "/"

 

For older versions, you need OnProcessData VB script in More options of the data source.

'Find "/" and delete the "/" and text before'
i = Instr(Value,"/")
if i >= 1 Then
  Value  = Mid(Value, i+1)
End If

 

0
Avatar
Michael Toupin (mtoupin
Comment actions Permalink

You could even simplify it down further:
 

value = mid(value,instr(value,"/") + 1)

0
Avatar
Legacy Poster
Comment actions Permalink

Thanks for the script.  I couldn't use the transforms tab because I don't want it to do that always, it is based on some other field values.

The script Mike gave me worked for my use!

 

Thanks again

Please sign in to leave a comment.