Vb Script - Hide Label Objects During Printing When Certain Values Come In.
Hello.. I am working on VB Script that is printing data from XML file. There is a field in XML called warning. I have a Text Object with shared Database field of warning. Another Text Object has Warning Text that I only want to make visible or print if the data coming in from the XML has value of "warning". If it doens't then I want the text to be blank or hide it.
I tried this in the Text VB Script function:
if Format.NamedSubStrings("warning").Value <> "warning" then Format.NamedSubStrings("LydairWarning1").Value = " "
It doesn't work as expected. I am new to VB Scripting would there be a way to do this? I have some programming background but, not a lot with setting up variables or Objects with VB.
I am using Bartender Automation 9.4 SR3 having Commander work with Bartender to automatically print labels to defined printers.
Thank You.
Josh
I tried this in the Text VB Script function:
if Format.NamedSubStrings("warning").Value <> "warning" then Format.NamedSubStrings("LydairWarning1").Value = " "
It doesn't work as expected. I am new to VB Scripting would there be a way to do this? I have some programming background but, not a lot with setting up variables or Objects with VB.
I am using Bartender Automation 9.4 SR3 having Commander work with Bartender to automatically print labels to defined printers.
Thank You.
Josh
0
-
Legacy Poster
★ BarTender Hero ★
Would be easier if we could get a copy of the .btw files. As a new signup, I'm not sure if you have that forum ability or not. Also, what is it doing that's expected. Remember that this code is case sensitive as well, so if your warning field says "Warning", it will resolve to false when compared to "warning".
The following code worked for me. I put this as the [i]Data Source[/i] > [i]Visual Basic Script[/i] > [i]Multi-Line Script[/i] for the field I wanted to hide/show based on the "warning" field:
[code]if Format.NamedSubStrings("warning").Value <> "warning" then
Value = ""
else
Value = "Yes"
end if[/code]
Edit: Also, if you haven't, you need to be sure to name your sub-string. It is not enough simply to select a field name from your database. From the[i] Data Source[/i] tab, click [i]Advanced[/i], and then the [i]Share/Name[/i] tab. This is the name referred to in the [b]NamedSubStrings[/b]() function.0 -
Legacy Poster
★ BarTender Hero ★
[quote name='nRyder' timestamp='1329321965' post='1742']
Would be easier if we could get a copy of the .btw files. As a new signup, I'm not sure if you have that forum ability or not. Also, what is it doing that's expected. Remember that this code is case sensitive as well, so if your warning field says "Warning", it will resolve to false when compared to "warning".
The following code worked for me. I put this as the [i]Data Source[/i] > [i]Visual Basic Script[/i] > [i]Multi-Line Script[/i] for the field I wanted to hide/show based on the "warning" field:
[code]if Format.NamedSubStrings("warning").Value <> "warning" then
Value = ""
else
Value = "Yes"
end if[/code]
Edit: Also, if you haven't, you need to be sure to name your sub-string. It is not enough simply to select a field name from your database. From the[i] Data Source[/i] tab, click [i]Advanced[/i], and then the [i]Share/Name[/i] tab. This is the name referred to in the [b]NamedSubStrings[/b]() function.
[/quote]
Thank you Nryder. That worked along with a couple of Object settings I changed in the Bartender Template. I attached a copy of the Carton_Test.btw file along with 2 xml files I saved as text files to show how I tested the logic. Hopefully this is helpful to other users of Bartender that need to use this logic.
Regards,
Josh0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
2 commentaires