How to write BTXML data into MS SQL database table
Hi,
is there a simple way to read BTXML data and insert into MS SQL tabele as new record?
Following BTXML data as sample:
<XMLScript Version="2.0">
<Command>
<Print JobName="Test-Print job name">
<Format>lib://Testlayout.btw</Format>
<PrintSetup>
<Printer>Pinter name</Printer>
<IdenticalCopiesOfLabel>1</IdenticalCopiesOfLabel>
</PrintSetup>
<NamedSubString Name="Empfaenger">
<Value>Shipto</Value>
</NamedSubString>
<NamedSubString Name="EmpfAdr1">
<Value>Shipto line 1</Value>
</NamedSubString>
<NamedSubString Name="EmpfAdr2">
<Value>Shipto line 2</Value>
</NamedSubString>
<NamedSubString Name="EmpfAdr3">
<Value>Shipto line 3</Value>
</NamedSubString>
<NamedSubString Name="EmpfAdr4">
<Value>Shipto line 4</Value>
</NamedSubString>
<NamedSubString Name="Absender">
<Value>Sender</Value>
</NamedSubString>
<NamedSubString Name="AbsAdr1">
<Value>Sender line 1</Value>
</NamedSubString>
<NamedSubString Name="AbsAdr2">
<Value>Sender line 2</Value>
</NamedSubString>
<NamedSubString Name="AbsAdr3">
<Value>Sender line 3</Value>
</NamedSubString>
<NamedSubString Name="AbsAdr4">
<Value>Sender line 4</Value>
</NamedSubString>
<NamedSubString Name="Paketnummer">
<Value>1234567890123</Value>
</NamedSubString>
</Print>
</Command>
</XMLScript>
-
Peter Thane
★ BarTender Hero ★
Not sure if the Update or Insert Database records Action option could be of use to you.
0 -
Andreas Meichsner
★ BarTender Hero ★
Hi Peter,
no, the Insert database record action is useless, if you cannot "read" the named datasources from BTXML.
I've found a workaround, but there should be an easierer and more dynamic solution.
1) I convert BTXML into CSV data structure (with Convert XML using XSLT action)
2) Convert text to data record using csv data strucure from Step 1... to get the named datasource / value pairs
3) For each data record in the database action
4) Finally Insert database record action is used for maooing the database fields with named datasources from CSV
The simplified action list looks as follows
Maybe you have a better idea/solution
Best regards,
Andreas
0
Iniciar sesión para dejar un comentario.
Comentarios
2 comentarios