Using Strings
Hi,
How can I use the Contains String function to see if my data contains a certain value.
Here is my VB attempt but I keep getting an error:
sku = Field("SKU")
if sku contains "test" then
value = "true"
else value = "false"
end if
-
Peter Thane
★ BarTender Hero ★
You will need to run a text compare on the string to look for the value which will then give you a number of the start position of the element you are looking for.
This should work for you:
Value = "False"
Value1 = Field("texttest.texttest.desc")
If InStr(1,Value1,"test",1) > 0 then
Value = "True"
else Value = Valueend if
It looks like you are looking for the value from a database at print time and so you should configure this to run as an Event Controlled Script>OnNewRecord and so should be configured like this.
Here is what I get running this with a very simple database, looking for the word test in side another text field
0 -
REN DUTOIT
★ BarTender Hero ★
Thankyou very much for the quick response and elaborate demonstration.
Your solution worked perfectly.
0
Please sign in to leave a comment.
Comments
2 comments