Assigning Data To Named Objects
I have a label that pulls data in conditionally from several databases. After gathering all the data I need to assign it to several named objects on the label.
I use the following code:
Format.NamedSubStrings("SHText-block").Value = SHText
Format.NamedSubStrings("GHS1").Value = tmp1
Format.NamedSubStrings("GHS2").Value = tmp2
Format.NamedSubStrings("GHS3").Value = tmp3
Format.NamedSubStrings("GHS4").Value = tmp4
Format.NamedSubStrings("GHS5").Value = tmp5
The first assignment works just fine and the text displays on the label as expected. None of the other assignments seem to work. I used msgBox commands to see what was going on and it appears the the label just stops after the first assignment.
Any ideas on what could be causing this?
-
Shotaro Ito
★ BarTender Hero ★
Make sure you have the named datasources (substrings) "GHS1"..."GHS5" on the format.
Could you attach the label format from [more reply options]?
0 -
Legacy Poster
★ BarTender Hero ★
I have attached the label.
0 -
Shotaro Ito
★ BarTender Hero ★
I have attached the label.
it looks you stored image in C:\Commander\Templates\Images\ , right?
Named datasource GHS5 is not found in the label format - that would causes error at least.
The document contains quite complex VB Script - it's not very easy for me to understand without data (um- even difficult with data too).
For GHS labels, try using our sample coming with BarTender 10.1 sample
http://www.seagullscientific.com/label-software/whitepapers/ghs-compliance-labeling-201406.pdf
(this one also includes very complex VB script, though)
0 -
Legacy Poster
★ BarTender Hero ★
I simplified the label down to the bare essentials - the fields that I need to fill and the field with the script. I noticed that when the script stopts working it is also displying an "endless loop" error. Where could this error possibly be occuring?
Dim SHText, tmp1, tmp2, tmp3, tmp4
SHText = "An inconvenience is only an adventure wrongly considered; an adventure is an inconvenience rightly considered."tmp1 = "CorrosiveGHS.JPG"
tmp2 = "ExplosiveGHS.JPG"
tmp3 = "ExclamationGHS.JPG"
tmp4 = "EnvironmentGHS.JPG"
tmp5 = "Health effectsGHS.JPG"
msgBox("SHText= " & SHText)
Format.NamedSubStrings("SHText-block").Value = SHText <----- this line appears to work as the text above
appears in the label but the script aborts at this
point with the "endless loop" error
msgBox("tmp1 = " & tmp1)
Format.NamedSubStrings("GHS1").Value = tmp1
msgBox("tmp2 = " & tmp2)
Format.NamedSubStrings("GHS2").Value = tmp2
msgBox("tmp3 = " & tmp3)
Format.NamedSubStrings("GHS3").Value = tmp3
msgBox("tmp4 = " & tmp4)
Format.NamedSubStrings("GHS4").Value = tmp4
msgBox("tmp5 = " & tmp5)
Format.NamedSubStrings("GHS5").Value = tmp5
0 -
Shotaro Ito
★ BarTender Hero ★
Thanks for strip down ver - it looks the format works here in BarTender 10.1SR3 GUI when database disabled. You need to click [OK] on the msgbox dialog to proceed.
try remove all "msgbox" part - it won't cope well with Commander. (When Commander is running as background service, it cannot press [OK] - bartender just waits forever.)
Enable BarTender's job logging instead to check values are handled in BarTender.(Administer > Log options, Text file > Log Print Job information.)
0 -
Legacy Poster
★ BarTender Hero ★
I removed the message boxes, the database connection and set the log file, and still the same result - an endless loop error.
0 -
Shotaro Ito
★ BarTender Hero ★
I have out of idea - The script itself doesn't have a loop and nothing to be waiting except msgbox.
In such case, I would create document from scratch (perhaps some parts copied from original doc.)
Would that be possibly handled using "search and replace" transform etc?
0 -
Legacy Poster
★ BarTender Hero ★
I thought of that as well. I created a brand new label with just two objects, one with the script and one being written to. I received the same error message. It leads me to believe that the error is either environmental or an issue with the Format.NamedSubStrings function. Unfortunately, I have not been able to find any documentation on that function. Do you know if any exists?
0 -
Shotaro Ito
★ BarTender Hero ★
That's in Online help - but doesn't have much detailed doc.
Shorthand of
Format.NamedSubStrings("GHS1").Value = tmp1
is
GHS1 = tmp1
0
Please sign in to leave a comment.
Comments
9 comments