Need A Vb Script To Read Only After Last ":" From The Data Follow

0
Avatar
Legacy Poster

Need a VB Script to read only after last ":" from the data


This my data

X-Toy:X-Fan:4PX
X-Toy:X-Fan:2PPO
X-Toy:4PP
X-Toy:10P

and after the vb script it should be like this

4PX
2PPO
4PP
10P

Thank you

 

I have it done in html as attached but I don't know how to do it in bartender

 

<script type="text/vbscript">
   Sub DoSomethingVBScript()
    Dim inputBoxValue
    inputBoxValue = document.getElementById("inputBox").value
    Dim lastIndex
    lastIndex = InStrRev(inputBoxValue, ":")
    Dim result
    result = Mid(inputBoxValue, lastIndex + 1, Len(inputBoxValue) - lastIndex)
    resultLabel.innerText = result
   End Sub
  </script>
 </head>
 <body>
  <div>
   <h1 style="font-family:Comic Sans MS">Enter Something</h1>
   <br />
   <input style="font-size:14pt; width: 500px"
          type="text" id="inputBox" value="X-Toy:X-Fan:4PX"></input>
   <br />
   <input style="font-size:14pt"
                type="button"
          value="Click Me!"
                   onclick="doSomething()" />
   <input style="font-size:14pt"
                type="button"
          value="Click Me VB Script!"
                   onclick="DoSomethingVBScript()" />
   <br />
   <div style="font-size:14pt; font-family:Comic Sans MS"
        id="resultLabel"></div>
  </div>
  </body>
</html>

 

3 comments

0
Avatar
Michael Toupin (mtoupin
Comment actions Permalink

Try this:

 

 

data = split(value,":")
value =data(ubound(data))
 
It'll do everything you're looking for.
0
Avatar
Legacy Poster
Comment actions Permalink

Thank you it works fine but I am getting an

error #3907 OnProcessData(line 2): : Subscript out of range: 'ubound(...)

0
Avatar
Michael Toupin (mtoupin
Comment actions Permalink

You'll get that if there's no data being processed, if you're passing null values at some point make sure to do a test for data - easiest way to do that would be to surround it with something like:

 

If value <> "" then

 

 

end if

Please sign in to leave a comment.