Print Or Hide Object Using Text File Follow

0
Avatar
Legacy Poster

Hello, of course I'm a newbie to Bartender VB Scripting. I have a pipe delimited text file that we use for the data source. I have a field called "[size="1"]receipts_database.Inspect"[/size] in the text file that gives a "Yes" or "No" value. This lets us know if an item has to be inspected or not. If the field prints a value of Yes I want an "I" to print on the label which signifies the product has to be inspected. If the value is "No" in the file, nothing should print there. In the text obect under the "General" tab where it say object name. I named the object "Inspect"

I'm a little confused if I should select the Source as; Database Field, Screen Data or Label Object String. For now I have selected Screen Data and entered an "I".

The script I wrote below does not work. I get an error message "Object required: 'Inspect'
[size="1"]
If (Field ("receipts_database.Inspect") = "Yes") Then
Inspect.PrintVisibility = True
Else
Inspect.PrintVisibility = False
End If

I attached the .btw file and a screen shot. If anyone can help me it will be much appreciated.

thanks

Richard

[/size]

3 comments

0
Avatar
Shotaro Ito
Comment actions Permalink

Hi Rrenix,

Try OnProcessData script to modify input - when value is empty (""), the text won't be printed.
Create a text, get datasource from database field "receipts_database.Inspect".
In More options (Transform)> VB Script > OnProcessData event, place code like below:

[code]If Value = "Yes" Then
Value = "I"
Else
Value = ""
End If
[/code]
0
Avatar
Legacy Poster
Comment actions Permalink

Shotaro-san, thank you very much for your help! That got me very close however I now a have another issue. When I press the Test button in Bartender to test run the script it shows correctly with an "I" but when I actually print labels to my printer it's physically printing a "Y". Do you know why that's happening? When the value = "No" nothing is being printed which is correct. I have attached the modified btw file.


Thank You very much for you help!


[quote name='Shotaro I -Seagull Support' timestamp='1335919227' post='2336']
Hi Rrenix,

Try OnProcessData script to modify input - when value is empty (""), the text won't be printed.
Create a text, get datasource from database field "receipts_database.Inspect".
In More options (Transform)> VB Script > OnProcessData event, place code like below:

[code]If Value = "Yes" Then
Value = "I"
Else
Value = ""
End If
[/code]
[/quote]
0
Avatar
Shotaro Ito
Comment actions Permalink

[quote name='rrenix' timestamp='1335968323' post='2345']
When I press the Test button in Bartender to test run the script it shows correctly with an "I" but when I actually print labels to my printer it's physically printing a "Y". Do you know why that's happening? When the value = "No" nothing is being printed which is correct. I have attached the modified btw file.
[/quote]
Hi rrenix, it looks the script itself is correct.
Would the problem only happens on printout and not in print preview?
In such case, you might use printer font and that caused printer.
Open the text, font tab, specify a Truetype / opentype font (Times New Roman, Arial etc), then uncheck [substitute best matching printer font] at the bottom of text tab.
Font substitution can be disabled from uncheck [Warn when using TrueType fonts] in Print dialog > Performance tab - after that, BarTender no longer change your TrueType font to printer font.
(To use printer font, select printer font like "Zebra Triumvirate" etc.)

Please sign in to leave a comment.