Database Field Not Populating Before Vb Script (Onprintjobend) Running
I am attempting to create GHS labels using the template that came with Bartender as a guide. To load files I am using Commander with a flat CSV-like file which populates the Database Field. So far all the text fields are loading when printing; however, the VB script to populate the pictograms is not working. Specifically, the following code is causing the problem:
...
ResetShownSymbols()
pictograms = Field("Sample Database.Field 18")
' should cause: pictograms = "Pictograms=Flame"'
pictograms_to_place = mid(pictograms, Instr(pictograms, "=")+1, len(pictograms))
' should cause: pictograms_to_place = "Flame"'
If (Not undrawAll) Then AddSymbols(pictograms_to_place)
...
In theory this should work and I have confirmed, using text fields, that "Field("Sample Database.Field 18")" does link to the right data and it can be displayed as plain text with the text I want. But calling on it in main VBS only causes an error when printing. From what I can surmise the VBS is running before the Sample Database.Field 18 is populated with data. However, I am running the script under OnPrintJobEnd so the field should be populated and there is no reason for it not to be populated so far as I can tell.
Other things I have tried:
- Pulling from an Excel file (this works), it is the change to the CSV-like file that is causing the issues.
- Troubleshooting and hardcoding the value for pictograms_to_place to be Flame works fine.
- Populating multiple text fields in the same way as I am trying to populate the pictograms and it works fine
- Populating text fields from other text fields to try and cause the population of the data fields to be prioritized
- Changing the VBS to call on a text field populated with the right information, this results in a blank image
In conclusion, I believe there to be some sort of timing issue with the loading of the database and the running of the Main PrintJob script any suggestions on how to fix this would be appreciated! :)
-
Resolved issue using ReferenceField() to open data channels and Format.WriteToLog() to force an update.
0
Please sign in to leave a comment.
Comments
1 comment