Skip to main content

Search

Search

Printing Multiple Record In An Xml File (Was Working Fine With Bartender 7.5 Csv)

Comments

16 comments

  • Avatar
    Ian Cummings
    Moderator

    From your screen shot, the page setup seems to have 6 rows across on an A4 sheet, and in this case, a row is equal to a label.

     

    XML script can do everything that Commander script can do, plus a whole lot more.

     

    When you say this, "The issue we are facing is to display multiple records per label."  What do you term as being a label?  In your example screenshot you have 6 labels on a page.

     

    Note that BarTender has never directly supported printing multiple records on a single label.

     

    Can you send us the BarTender document and XML file in order to better understand your problem?

    0
  • Avatar
    Legacy Poster

    Hello Ian, 

    Thank a lot for your answer. Here a some extra informations:

    The previous implementation was a trick to display an undefined number of text rows on a single label (a sheet). This trick was for sure not a nice one, but that worked!

     

    By sending empty fields to some variables we were able to achieve multiple rows by printing multiple "dummy labels" on a single sheet that is indeed one label.


    The number of products was not fixed and could go up to 6 products.

     

    You can imagine the result as: 
     

    Title1     Title2       Title3
    Product1   Product1    Product1
    Product2   Product2    Product2
    Product3   Product3    Product3
     

     
    The btw (turned into Bartenter 10 because I needed to remove some visual informations) is in attachement.

     

     

    But now, by using XML, despite the fact that we configured the same visual trick (6 labels per sheet), one label per sheet is printed and that is our current problem. Multiple sheets are printed.

     

    I guess that our problem would be to find a correct documentation on XML files and how we could print multiple "labels" on one single sheet (one real label).

    0
  • Avatar
    Ian Cummings
    Moderator

    To print variable data, in multiple, labels, in a single print job, then you should provide the variable data as record data, just like you did in Commander script:

     

    <?xml version="1.0" encoding="utf-8"?> 
    <XMLScript Version="2.0"> 
    <Command Name="Job1"> 
    <Print> 
    <Format>c:\BarTender\Document1.btw</Format> 
    <RecordSet Name="Text File 1" Type="btTextFile"> 
    <Delimitation>btDelimQuoteAndComma</Delimitation> 
    <UseFieldNamesFromFirstRecord>true</UseFieldNamesFromFirstRecord> 
    <TextData> 
    <![CDATA[ 
    "FirstName","LastName","City","Zip Code" 
    "Adam","Jones","Bellevue","98008", 
    "John","Smith","Kirkland","98293" 
    ]]> 
    </TextData> 
    </RecordSet> 
    </Print> 
    </Command> 
    </XMLScript> 
    

     

    The above example is taken from the BarTender Help system under the "Automating BarTender" topic.

    0
  • Avatar
    Legacy Poster

    Hello Ian,

     

    This is working fine, but just look like a strange solution (csv inside xml)

     

    Is there really no solution to work with 

     

     

    <NamedSubString Name="Vxx"><Value>value</Value></NamedSubString>
    

    Instead of text file???

    0
  • Avatar
    Ian Cummings
    Moderator

    The embedding of data records in XML is perfectly valid.  You can of course set data on the label via the <NamedSubString> tag, but the problem is that this is only of use per print job, whereas you need to change the data per label in a single print job.  Note that in XML a print job is represented by everything between the <Command> tags.

    0
  • Avatar
    Legacy Poster

    So am I correct in saying that you cannot have multiple labels being printed using the NamedSubString statement? So within one <Print> command you could not have the following? 

     

       <NamedSubString Name="Collective">
     <Value>Herd</Value>
        </NamedSubString>
     
        <NamedSubString Name="Vegetable">
     <Value>Onions</Value>
        </NamedSubString>

        <NamedSubString Name="Date">
     <Value>1962-02-19</Value>
        </NamedSubString>

       

    <NamedSubString Name="Collective">
     <Value>Tribe</Value>
        </NamedSubString>
     
        <NamedSubString Name="Vegetable">
     <Value>Kumara</Value>
        </NamedSubString>

        <NamedSubString Name="Date">
     <Value>1966-09-07</Value>
        </NamedSubString>

    0
  • Avatar
    Ian Cummings
    Moderator

    That is correct.  In you above example only "Kumara" and "1966-09-07" will be printed as that is what the object's data is set to last before the implicit print command triggers.  You can of course print multiple copies, but that isn't what you want.  To repeat, embedded record data is what you need to use -- period.

    0
  • Avatar
    Legacy Poster

    Thank you!

    0
  • Avatar
    Legacy Poster

    Hello, I know this is an old posting but it covers what I need. I have a vb app which printsdata to a pages containing 5 labels, but because I have been writing to each data field using the substring until now I can only print one of the labels. Now, we have to write to each label with it's own set. My question is, can one write to a field if not configured with a datasource only with a substring using the method explained in this post?

     

    I mean, can one use an XML script to write such as your example even if the fields are not configured with datasources?

     

    Thank you,

     

    Mark

    0
  • Avatar
    Ian Cummings
    Moderator

    I guess you mean that you wish to carry on using named data sources to set the data on multiple labels on a page in a single print job, be it using XML or otherwise?

     

    The answer here is no.  You should instead use record data and connect the document to the data file via automation at print time.  This can in fact be done with BTXML is you wish, but essentially you're still working with record data.  Setting data to named data sources can only be done once per print job, whereas record data can provide variable data to label objects on a per label (or x number of labels) basis.

    0
  • Avatar
    Legacy Poster

    So you are saying the bartender file has to have to database that uses a Text File and also with a table/fields configured, and the label & objects within it have to have the database/fields  as datasources; then one can use "record set" to write to each column (label) of the page sheet even if there are multiple of them. Is that correct?

    In my case I am using the Automation version 9.3 and attempted using the XmlScript below inside my vb.net application and got an error:

    "The XMLScript method requires Enterprise Automation edition. The BarTender Automation edition is currently installed."

     

    Besides going to the Enterprise Automation edition or trying to use an external text file as the database isntead of xml scrip what options are there?

     

    Thank you,

    0
  • Avatar
    Ian Cummings
    Moderator

    BTXML script requires the Enterprise Automation edition.

     

    Of course your automation code can just as easily connect your label design to a delimited text file of record data to produce one print job of variable data per label on one page in one print request.  To get what you want, this is the approach to take -- period.  The data sources of course would need to be setup with a database field type taking their data from the appropriate field.

    0
  • Avatar
    Legacy Poster

    To print variable data, in multiple, labels, in a single print job, then you should provide the variable data as record data, just like you did in Commander script:

     

    <?xml version="1.0" encoding="utf-8"?> 
    <XMLScript Version="2.0"> 
    <Command Name="Job1"> 
    <Print> 
    <Format>c:\BarTender\Document1.btw</Format> 
    <RecordSet Name="Text File 1" Type="btTextFile"> 
    <Delimitation>btDelimQuoteAndComma</Delimitation> 
    <UseFieldNamesFromFirstRecord>true</UseFieldNamesFromFirstRecord> 
    <TextData> 
    <![CDATA[ 
    "FirstName","LastName","City","Zip Code" 
    "Adam","Jones","Bellevue","98008", 
    "John","Smith","Kirkland","98293" 
    ]]> 
    </TextData> 
    </RecordSet> 
    </Print> 
    </Command> 
    </XMLScript> 
    

     

    The above example is taken from the BarTender Help system under the "Automating BarTender" topic.

     

    Hello Ian,

     

    So if I'd use the method above, the Response from Bartender will only come in regards of a single job ("Job1"), right? Or in other words, if there's print error, Bartender won't be able to report which/from which label hasn't been printed and will only return print error for whole Job1, correct? 

     

    Thank you!

     

    Kind regards,

    Donatas

    0
  • Avatar
    Ian Cummings
    Moderator

    donatas: Correct, the print job verification would be for the print job as a whole.  If you want it per label then you'd need to have multiple <command> tag requests with each <command> job printing a single label.

    0
  • Avatar
    Legacy Poster

    Thank you, Ian! 

     

    I can confirm, that nesting multiple <Command> nodes within single </XMLScript> node worked fine and multiple <Command> nodes, consisting of different errors made on a purpose (ie, wrong file name or printer), has been returned within a single <Response> node. 

    0
  • Avatar
    Legacy Poster

    I'm having the same problem, i though i can print multiple data using named datasource.

    0

Please sign in to leave a comment.