Format.namedsubstrings Property Error Follow

0
Avatar
Legacy Poster

Hi,

 

I'm currently working on an intertionalization of text label with BarTender 10.1 SR4. The translated texts are stored in different text files stored on disk. The BTW label uses the OnPrintJobStart document event to read the proper translation file depending on the content of a database field using the code below.

 

Instead of storing the files' path Inside the VBScript code, I've used a text integrated data named "Langue_chemin" to store it. When the event is triggered the Format.NamedSubStrings method is used to read the value of the  "Langue_chemin" data. During the development process everything worked just fine. When I launched previews I got my label preview (with the proper translation). At the end of the design I saved again the model then closed BT. When I opened it again and  tried to preview or print the label, I got an error message telling me the "Langue_chemin" object didn't have the Format.NamedSubString property.

 

I tried to create a new label based on a copy of another label designed previously with the SR2 (same design, code, event handling and working fine with SR4). Once again I got the same error after saving the file.

 

I tried to move the source code within other events, or directly inside a WBScript integrated object event thinking the issue could be related to an earlier call of a object which is not yet properly initialized but it didn't fix the issue.

 

Would you have an idea about ?

 

Thanks

 

Christophe

 

ReferenceField("DATA.Champ 1")

' Name of the translation file 
 

language_file = Field("DATA.Champ 1") & ".txt"

 

'  Read files' path from integreted data
 

language_path = Format.NamedSubStrings("Langue_chemin").Value

 

fichier = language_path & language_file

 

5 comments

0
Avatar
Legacy Poster
Comment actions Permalink

Hi,

 

To complete the information, today I tried to open the defunct model from another computer running BarTender 10.1 SR1. I got the same error message.

 

Christophe

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

I suggest you attach an example document and data files to this forum topic so I can take a look at what you're doing.  Not able to figure out what is wrong based on your description alone.

0
Avatar
Legacy Poster
Comment actions Permalink

Hello Ian,

 

Sorry for the late answer (I didn't get the nofitication you had posted an answer). Will do that tomorrow or Wednesday.

 

Thanks

 

Christophe

0
Avatar
Legacy Poster
Comment actions Permalink

Hello Ian,

 

Here is an example. By default the 3 following files have to be copied Inside a BarTender directory at C:\ level. These 3 files are :

- DATA.txt contains the data to be printed on the label

- FR.txt contains the French translation of the data zone "titles"  which are printed dynamically

- Label.btw is the defunct label 

 

In Label.btw, you will find 4 named data fields :

Format : I left it but it doesn't seem te be relevant to the problem I experience.

Langue_1 : should contain the French translation of the first data zone title (label)

Langue_2 : should contain the French translation of the second data zone title (label)

Langue_chemin : the directory path where the translation files are. I used this approach to allow path change without having to update the code within the label.

 

The document OnPrintJobstart event is used to dynamically open the appropriate translation file. This is where the issue is. On line 9, I use Format.NamedSubStrings to read Langue_Chemin value to get the directory path of the translation files. When I run the label I get the "this object doesn't handle the property of method 'format.NamedSubStrings'".

 

To note : I designed a label with SR1 version using the very same code without experiencing this issue. Interestingly this very label continues to be OK with SR4 (no error triggered).

 

When I started the design of a new label with SR4 everything was ok. Then sunddenly after adding a new field / object I got that error. I removed the field/object but the problem remained. I closed the label, restarted the computer with no success. I then create a brand new label and copied and pasted from the defunct one. The bug followed. I started again with a brand new label then added the fields and objects one at a time. It worked for the first ones, but suddenly failed. I started again and noted the bug occured randomly preventing me to focus on a specific field or object.

 

I tested different ways of handling label translations within BarTender and this approach is my favorite. As it seemed to work with SR1, I'm interested to understand why it no longer seems to work (mistake on my side, bug ?). BarTender is run on a Windows 7 / 64 bits.

 

Thanks for your help

 

Christophe

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

I suggest you make use of the "External File" data source type as this data source can easily have its path/filename sourced from some other data source such as a database field.  Other label object data sources can then connect to this data source performing various string functions to get the particular data you're wanting to print.
 
The FIC (Food Information to Consumers) label example on our website uses just such a technique for handling the various language translations for food allergens.  I suggest you take a look at it for implementing this in an easier way than you're trying currently.
 

Please sign in to leave a comment.