Change In Sql Table As A Trigger
Hoping someone can help. we are linking to a sql table with an ODBC connection.
We can populate the table from it's program and concurrently open Bartender to print the contents populated.
Basically we would like to know if there's a way (preferably simple) this table change can be a trigger for Bartender to print automatically.
The program is designed around Teklynx and purpose made to print straight to Codesoft. There's no way we can get the program changed unfortunately.
Appreciate any help, found Bartender a lot better to work with than Teklynx, currently using Automation.
-
Hello,
I'm afraid that BarTender/Commander cannot print automatically after your database will change.
If you want to automate your printing after to change your database table you will need to create an application or script that will generate a trigger with the new data to be printed or with a query to your database.
I would suggest to read our White Paper about Commander:
http://www.bartenderbarcodesoftware.com/label-software/whitepapers/commander-examples(english).pdf
I hope this will solve your question.
Thanks,
Carlos
0 -
This isn't too hard if you're proficient at SQL scripting. I've written several stored procedures that dump label data out to Commander. It does require the login that the SQL services are using to have permission for code execution, which may be a security issue for you...
Here's an exerpt from one of my procedures that writes XML out to a file for Commander to process:
Write a trigger on your table and do something similar and you're all set.
SELECT @xml_output = '<?xml version="1.0"?><XMLScript Version="2.0">' + '<Command Name="CaseLabels"><Print>' + '<Format CloseAtEndOfJob="true">\\skyline\shipping\Bar Tender Labels\Formats\Wal-Mart_UCC.btw</Format>' + '<NamedSubString Name="po_number"><Value>' + @po_number + '</Value></NamedSubString>' + '<NamedSubString Name="ship_to_name"><Value>' + @ship_to_name + '</Value></NamedSubString>' + '<NamedSubString Name="ship_to_address1"><Value>' + @ship_to_address1 + '</Value></NamedSubString>' IF @ship_to_address2 IS NOT NULL AND @ship_to_address2 <> '' BEGIN SELECT @xml_output = @xml_output + '<NamedSubString Name="ship_to_address2"><Value>' + @ship_to_address2 + '</Value></NamedSubString>' END SELECT @xml_output = @xml_output + '<NamedSubString Name="ship_to_city"><Value>' + @ship_to_city + '</Value></NamedSubString>' + '<NamedSubString Name="ship_to_state"><Value>' + @ship_to_state + '</Value></NamedSubString>' + '<NamedSubString Name="ship_to_zipcode"><Value>' + @ship_to_zipcode + '</Value></NamedSubString>' + '<NamedSubString Name="carrier"><Value>' + 'WMLI' + '</Value></NamedSubString>' + '<NamedSubString Name="bol"><Value>' + @bol + '</Value></NamedSubString>' + '<NamedSubString Name="loc"><Value>' + @location_code + '</Value></NamedSubString>' + '<NamedSubString Name="po_type"><Value>' + @po_type + '</Value></NamedSubString>' + '<NamedSubString Name="dept"><Value>' + @dept + '</Value></NamedSubString>' + '<NamedSubString Name="item_buyer_number"><Value>' + @item_buyer_number + '</Value></NamedSubString>' + '<NamedSubString Name="item_description"><Value>' + @item_description + '</Value></NamedSubString>' + '<PrintSetup><Printer>' + @printer + '</Printer><IdenticalCopiesOfLabel>' + @no_of_labels + '</IdenticalCopiesOfLabel>' + '</PrintSetup></Print></Command>' SELECT @command = 'bcp "select label_xml FROM ##GLOBAL_LABEL_TEMP where po = ''' + @po_number + '''" queryout ' + '\\server\scan_dir\' + @po_number + '.xml -w -T -S ' + @@servername EXECUTE master..xp_cmdshell @command, NO_OUTPUT
I'm sure there are plenty of other ways also, but this method has worked well for years.
0 -
Many thanks to both of you for replying, it's a great help and will save a small fortune bypassing codesoft
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
3 Kommentare