How To Bind Recordset Table To Textobject With Addifnone=True?
I have a label with some text objects on it with shared datasources. Some of them are serialized. What I want to do is fill those objects with other information using BTXML.
On my label I have an text object with the name: Serialnumber (serialized and without any external datasources). My question is: how can I bind the recordset to the text object?
What I have is:
<?xml version="1.0" encoding="utf-8"?> <XMLScript Version="2.0"> <Command Name="P140218Test"> <Print> <Format>lib://Test/SNR_P140218.btw</Format> <PrintSetup> <NumberSerializedLabels>1</NumberSerializedLabels> <UseDatabase>true</UseDatabase> </PrintSetup> <RecordSet Name="textData" Type="btTextFile" AddIfNone="true"> <Delimitation>btDelimQuoteAndComma</Delimitation> <UseFieldNamesFromFirstRecord>true</UseFieldNamesFromFirstRecord> <TextData> <![CDATA[ "Serial" "98008", "98293", "91292" ]]> </TextData> </RecordSet> </Print> </Command> </XMLScript>
-
Shotaro Ito
★ BarTender Hero ★
I'm not sure I understood the question precisely - though, you set value to named data source by NamedSubString tag in Print tag.
you need to give a share name the datasource of the text object.<NamedSubString Name="Serialnumber"> <Value>4980</Value> </NamedSubString>
Note that this value applied to every records in the Print tag.
0 -
Legacy Poster
★ BarTender Hero ★
Thanks for reply.
Normaly I do something like this:<?xml version="1.0" encoding="utf-8"?> <XMLScript Version="2.0"> <Command Name="DoosSticker"> <Print> <Format>lib://folder/Doossticker.btw</Format> <NamedSubString Name="SerialNr"> <Value>1234</Value> </NamedSubString> </Print> </Command> </XMLScript>
This works very well if there is only one label on the carrier but in this case I need to print three labels at one time. So I am looking for a way to generate a print job with 3 pages and each of them with different information.
I hope I am more clear enough now.0 -
Fernando Ramos Miracle
★ BarTender Hero ★
Hello,
You only need to add consecutive commands to generate more than one print job with a single BT XML script.
For more information (including examples) please search for the topic "Printing Items Using BTXML Script" in BarTender's Help documentation.
Regards.
0 -
Shotaro Ito
★ BarTender Hero ★
As Fernando say, you have to divide to 3 Print commands when you want set substring value for each 3 pages. if you want to issue within single Print command, I would include the field into database columns.
0 -
Legacy Poster
★ BarTender Hero ★
Thanks for reply,
I know how to put three print commands in a single btxml file. But when I do that with the following label: THT-5 the printer skip 2 labels after a print command. So when I send three print commands I loose six labels.<?xml version="1.0" encoding="utf-8"?> <XMLScript Version="2.0"> <Command Name="DoosSticker"> <Print> <Format>lib://folder/Doossticker.btw</Format> <NamedSubString Name="SerialNr"> <Value>1234</Value> </NamedSubString> </Print> <Print> <Format>lib://folder/Doossticker.btw</Format> <NamedSubString Name="SerialNr"> <Value>5678</Value> </NamedSubString> </Print> <Print> <Format>lib://folder/Doossticker.btw</Format> <NamedSubString Name="SerialNr"> <Value>9012</Value> </NamedSubString> </Print> </Command> </XMLScript>
If I am wrong... can you give some examples. Otherwise can you tell me how to deal with the AddIfNone property. How I can bind a column from the recordset to an textobject within btxml?
0 -
Your initial approach is correct:
<TextData>
<![CDATA[
"Serial"
"98008",
"98293",
"91292"
]]></TextData>
In BarTender, for those data sources which you want to link to the <TextData>, you would first connect the BarTender document to a "sample" text file database with the same structure as the text database you will send at print time. You do this connection via BarTender's "File > Database Connection Setup" dialog.
After this has been done, for those data sources on the label which will read its variable value from this text database <TextData>, you will open its properties and change its source to be "Database Field". Once this has been completed make sure to choose as well from which database field it will read from (in your case "Serial").
The second approach (using NamedSubString) is also a valid approach, but it seems that your printer is inserting some blank labels at the end of the print job. What printer make and model is this and what printer driver (and version) have you installed for it? You should as well check if the page setup you've done for your BarTender document is correct.
0 -
Legacy Poster
★ BarTender Hero ★
Keep in mind that I only want to use one label design. When printing in labelstation "textobject 1" must be serialized. When using my custom .net application I want to control "Textobject 1" by a recordset using btxml.
I know my initial approach works. I did already what you discriped but I had problems to switch between an recordset and serialization.
In BarTender, for those data sources which you want to link to the <TextData>, you would first connect the BarTender document to a "sample" text file database with the same structure as the text database you will send at print time. You do this connection via BarTender's "File > Database Connection Setup" dialog.
After this has been done, for those data sources on the label which will read its variable value from this text database <TextData>, you will open its properties and change its source to be "Database Field". Once this has been completed make sure to choose as well from which database field it will read from (in your case "Serial").The printer I use is an Datamax E4305A with the seagull drivers installed. Keep here also in mind that the label works fine in Bartender Print Station with serialization.
0 -
By looking at some XML Script examples in more detail, it looks like you don't actually need to connect the document to a database via the "File > Database Connection Setup" dialog. You would just need to change the source for the data sources to be "Database Field" and give it the database field name "Serial". This should work correctly when using CDATA, and would still allow you to assign the data manually when printing directly via BarTender or Print Station.
0 -
Legacy Poster
★ BarTender Hero ★
Thanks, You solved my problem almost.
This was where I am looking for:
You would just need to change the source for the data sources to be "Database Field" and give it the database field name "Serial"
The only problem I had was the serialization. It doesn't keep the serialization counter.
I did the following to fix this:
By design I add two data sources. One "Embedded Data" with serialization named "UniekSerienummer". A second data source "Database Field" with fieldname "Serial" and without sample field data. In the XML I used NamedSubstring to suppress "UniekSerienummer" and used an recordset (AddIfNone=true) to fill the serialnumbers.<?xml version="1.0" encoding="utf-8"?> <XMLScript Version="2.0"> <Command Name="P140218Test"> <Print> <Format>lib://Projecten/SNR_P140218.btw</Format> <NamedSubString Name="UniekSerienummer"> <Value></Value> </NamedSubString> <PrintSetup> <NumberSerializedLabels>1</NumberSerializedLabels> <UseDatabase>true</UseDatabase> </PrintSetup> <RecordSet Name="textData" Type="btTextFile" AddIfNone="true"> <Delimitation>btDelimQuoteAndComma</Delimitation> <UseFieldNamesFromFirstRecord>true</UseFieldNamesFromFirstRecord> <TextData> <![CDATA[ "Serial" "98001", "98002", "91003" ]]> </TextData> </RecordSet> </Print> </Command> </XMLScript>
Thanks for helping!
0 -
Simon Rothwangl
★ BarTender Hero ★
Hi,
to help anyone who is struggling with multi row printing,
here are two examples 1 "named data source" and 2 Named "named data source's"
1.) One "named data source" eight labels in one row:
<?xml version="1.0" encoding="utf-8"?>
<XMLScript Version="2.0">
<Command Name="Job1">
<Print>
<Format>c:\KomAufkleber14.btw</Format>
<RecordSet Name="textData" Type="btTextFile" AddIfNone="true">
<Delimitation>btDelimQuoteAndComma</Delimitation>
<UseFieldNamesFromFirstRecord>true</UseFieldNamesFromFirstRecord>
<TextData>
<![CDATA[
"V01"
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8"
]]>
</TextData>
</RecordSet>
</Print>
</Command>
</XMLScript>1.) Two "named data source's" four labels in one row:
<?xml version="1.0" encoding="utf-8"?>
<XMLScript Version="2.0">
<Command Name="Job1">
<Print>
<Format>c:\KomAufkleber14.btw</Format>
<RecordSet Name="textData" Type="btTextFile" AddIfNone="true">
<Delimitation>btDelimQuoteAndComma</Delimitation>
<UseFieldNamesFromFirstRecord>true</UseFieldNamesFromFirstRecord>
<TextData>
<![CDATA[
"V01","V02"
"1","2"
"3","4"
"5","6"
"7","8"
]]>
</TextData>
</RecordSet>
</Print>
</Command>
</XMLScript>Best regards.
Simon
0
請登入寫評論。
評論
10 條評論