Database Process By Global Function Follow

Legacy Poster



oops: Sorry don't know how to change the topic, It's called that because I want to use a global function to extract the xml data in the field for various text boxes on the 5th template - despatch note.  Forgot to mention that.


I have an issue with Bartender that is showing a blank field when it does contain data and would appreciate some help.


The label was getting very crowded and really difficult to maintain so I split it up into 8 templates each template is triggered by a datasource 'bsta', 'bend', 'bord','bdes' etc. which is held in the first non-printed label.  The type is decided by the row of the results that effectively specfies the label type. This bit works fine, the correct data is printed in each case.



'sta',1,'wave start',''

'ord',2,'order start',''

'box',3,'box 1',''

'box',4,'box 2',''


'des',6,'despatch note','<addr1>TESTADDRl1</addr1><addr2>TESTADDRl2</addr2>'

'end',7,'wave end'


However, on one of the templates I have an despatch note (des), because the despatch note is basically a separate record in the same set of templates i decided the stored procedure should generate it as an XML field on the row that is the despatch row.  This is the reason that the last field is xml meta data in the above example when the record is 'des'.


Again, this is all fine, if i drop a text control onto the form accessing DespatchMeta i see the value is correct.


So basically the label solution works fine (each one on a separate page) except for not being able to process the meta data yet.


So the obvious solution (as a first step) was to simply change the 'Despatch' template address text field type as follows:


VBScript: 'Single-Line Expression' 

expresison: Field("MetaData")


and watch the meta data flow onto the despatch page, er no!


When i do this nothing is displayed at all.  I know that the data is correct but it appears to not have been prepared.


PS: I have tried:

 - simpler fields that only contain 3 letters

 - using Reference to reference the field

 - using EventControlScripts and OnAutoSelectedEvent instead of the above SingleLineExpression



Only using the 'raw dump' of the field works.  I need to process this field to extract the data held within it.

So, now I am at a loss.  Really don't want to go back to the jumble of labels on one label as it was so difficult to maintain!


Any help or other suggestions of a possible method of doing this elegantly greatly appreciated.


Bartender 10.1 SP1.

Windows 7.





Legacy Poster
Comment actions Permalink

In the hopes of helping others:


No matter what i tried the even without any Templates using just a single label the visual basic was not passed the correct field but directly accessing the field works fine.  So in the end i started looking for other ways of doing it.


In the end I managed to 'work around' this by using a Database field that uses VBScript to transform the data; parsing out the required tag(s).


using the following methodolgy:


Created the text item as

    Type: Data Base Field,

    Column: DespatchMeta


Added a Transform onto the Text/Properties/Transform Tab:

   Type: Use VB Scripting

   Functions And Subs:  The simple tag extract function FindXml

   OnProcessData:  Value=FindXml(Value,"addr1")



One point of note I often see the Common functions as Global, they are NOT.  They are COMMON to the SECTION of bartender you are working with from what i can tell. So if you set Common Functions for the document events, the document events can use it.  But the one for the Transform for Text boxes can not.  Its very counter intuitive and all very messy IMHO but it is what it is I guess :(  In this case its even worse because it means i have to copy and paste the 'common' function into every single 'common' text box that wants to use?!!?!



Hope this helps.

Legacy Poster
Comment actions Permalink


        Your scenario is a bit like some of mine in that they can be quite complicated and difficult to explain in a forum post! It seems that sans your implementation, the crux of your question is about whether global code can be loaded for BarTender application-wide in scope, or even entire label-scoped, and you've found that it appears to not be the case. Maybe Seagull techs will have a response to that one. I would think that there might be a lib path that code could be saved to within the application folders to be included, but that's just optimistic thinking. :)


       One route you can take (as I have at times) is to perform your scripting outside of BarTender, and call it's objects to trigger printing.


On a side note, since there are always many ways to accomplish a particular task, it sounds like you could perform the selection of the different label formats you have and trigger its printing via Commander by just dropping an XML file in your polling directory...  Just thoughts.



Legacy Poster
Comment actions Permalink

Thanks MightyGorilla (cool name!) for your answer/suggestions - yes its a bit horrendous really but it was the only way I could see to get the speed we required an order of 10x faster at least than loading up separate docs.  I did passingly think about using a DLL of some sort and exposing an entry point for the parser but the whole thing would mean a dependency on yet another file, something i am really rather not too keen on and don't have the time for at this point.


We do some driving of Bartender but I simply don't have the time to script it all outside of BT as this is just a seemingly tiny part   :rolleyes:   of a much larger project.


I too would be interested to hear from bartender on this, as it seems like a real headache to get vbscript  code that can be re-used all over bartender. The best i have managed so far is a component, but that just makes copies all over the place.  I am guessing the only true way is a plugin DLL of some sort.  However,  If i don't see any answer on here in a few days I will raise the case through our Support contract as we need an answer to this one really for future reference.

Please sign in to leave a comment.