Which Is Faster: Get Record From Sqlserver Or Textfile&commander
Hi, I am working with BT2016 Automation.
I finally got it integrated to ERP Dynamics NAV 2016.
What I do is link a BT label to Dynamic NAV SQLServer database.
From integrating I use ActiveX automation, this is, I write a piece of code in Dynamics NAV that opens BT, gets a label, pass an sqlquery with the record i need to print and finally prints it.
This works like charm!
My question is... instead of making BT fetch a record from SQL server, should i try to get the data I want to
print from Dynamics NAV, and then save it as a text file for Commander to print???
Would this be faster?
-
If you're printing just the one record per print job, you might wish to name the data sources you wish to use in the BarTender document, and then use the SetNamedSubStringValue() method as below.
// Set the value of the ProductName data source
btFormat.SetNamedSubStringValue("ProductName", "Fruit Loops");
0 -
Hi Ian, your solution has worked out as charm! Thank you
Now, due to our customers requirements, we need to build dynamically a label. I explain myself: lets think we have field A, field B, field C in our systems databases.
Now, when we print a label to customer 1, we print field A and field B, but we dont print field C
Customer 2, needs field B and C, but no A
Customer 3 needs field A and C, but no B
I have created a label with just ONE datasource.
In real time, our ERP, using this btFormat.SetNamedSubStringValue, builds the information needed based on the customer, something like
CASE Label is for
Customer A:: btformat.setnamedsubstringvalue("SingleDatasource", Field A + Field B)
Customer B: btformat.setnamedsubstringvalue("SingleDatasource", Field B + Field C)
Customer C:: btformat.setnamedsubstringvalue("SingleDataSource", Field A + Field C)
END CASE
And I get one string with all information required.
Up to this point everything is fine.
Now I wish to insert a <CR><LF> between fields, so the label string dont look like:
Field A + Field B
but:
Field A
Field B
The question is: is there any command that make an string break into several lines? (is there any command I could place between fields to create a <CR><LF> and print this fields in differents lines and not all mixed up in a single long string?
Of course... using btformat.setnamedsubstringvalue method.
Thank you
0 -
Are you not able to insert the control character Chr(13) into your data string directly? Alternatively you could use something like the literal string "<CR>" in your overall string, and adjust the "Transform" settings in BarTender's data source to do a find and replace on all <CR>'s with the actual control code.
0 -
PERFECT!
the "transform" solution works great!
Thank you
0
请先登录再写评论。
评论
4 条评论