跳到主内容

搜索

搜索

Which Is Faster: Get Record From Sqlserver Or Textfile&commander

评论

4 条评论

  • Avatar
    Ian Cummings
    版主

    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
  • Avatar
    Legacy Poster

    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
  • Avatar
    Ian Cummings
    版主

    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
  • Avatar
    Legacy Poster

    PERFECT!

    the "transform" solution works great!

    Thank you

    0

请先登录再写评论。