跳至主內容

搜尋

搜尋

Multiple records with web service integration

評論

8 條評論

  • Avatar
    Doug Dekker

    Does Bartender 2022 R1 181316 have the ability to process JSON arrays for printing multiple labels from one web service POST?

    2
  • Avatar
    Kris Reddy

    Looking for similar solution

    Trying out the trial, integration is easy with web service, however we can only only send 1 json item and not an array.

    Is there a way bartender can parse json array and print multiple in one web service request?

    For example:

    [{
    "PrinterName":"TEC-SX4"
    ,"LabelName":"Test.btw"
    ,"ProductID":"12546"
    ,"LatinName":"Product 1'"
    ,"Qty":"2"
    },
    {
    "PrinterName":"TEC-SX4"
    ,"LabelName":"Test.btw"
    ,"ProductID":"8956"
    ,"LatinName":"Product 2'"
    ,"Qty":"2"
    },
    ....
    ...]

    Is this possible?

    Please advise,

    Kris

     

     

    0
  • Avatar
    Jasper Wen
    版主

    BarTender's Integration Platform currently doesn't support JSON arrays natively out of the box. We already have a feature request submitted in our system.

    At the moment, you can workaround this by using a PowerShell script action to convert a JSON array into a comma separated value format which the Integration Platform and BarTender can interpret. The Powershell script action would be something like this. Of course, you can use Integration variables instead where appropriate.

    1. Have a variable with some JSON data- $jsonArray = '{"PrintJob":[
      {"PrinterName":"TEC-SX4","LabelName":"Test.btw","ProductID":"12546","LatinName":"Product 1","Qty":"2"},
      {"PrinterName":"TEC-SX4","LabelName":"Test.btw","ProductID":"8956","LatinName":"Product 2","Qty":"2"}
      ]}' 
    2. Converts the JSON data into Powershell Object- $jsonArray = $jsonArray | ConvertFrom-JSON
    3. Converts the Powershell object and data into a comma separated value format and assigns it to a variable- $outputCSV = $jsonArray.PrintJob | ConvertTo-Csv -NoTypeInformation

    Once you get the data in a CSV format, you then should be able to use the Integration database and print actions such as the transform text to record set, for each database record, and print document action action to print multiple records/labels.

    0
  • Avatar
    Steve Williams

    Currently I am running tests in the 30 day trial version, trying to pass multiple records to the web service request.

    Obviously JSON is fine for passing a single record but I have seen another article in this forum (http://forums.seagullscientific.com/topic/1570-printing-multiple-record-in-an-xml-file-was-working-fine-with-bartender-75-csv/ ) which suggested that it was possible to pass multiple records using BTXML like this below:

    <?xml version="1.0" encoding="utf-8"?>
    <XMLScript Version="2.0">
    <Command Name="Job1">
    <Print>
    <Format>c:\BarTender\Document1.btw</Format>
    <RecordSet Name="Text File 1" Type="btTextFile">
    <Delimitation>btDelimQuoteAndComma</Delimitation>
    <UseFieldNamesFromFirstRecord>true</UseFieldNamesFromFirstRecord>
    <TextData>
    <![CDATA[
    "FirstName","LastName","City","Zip Code"
    "Adam","Jones","Bellevue","98008",
    "John","Smith","Kirkland","98293"
    ]]>
    </TextData>
    </RecordSet>
    </Print>
    </Command>
    </XMLScript>

    I have tried this but it doesn't work. I don't get any errors. The messages in my Insomnia REST Client show a WaitStatus of "Completed", Validated = true, "BarTender successfully sent the job etc. etc.". The printer produces a blank sheet of paper.

    It does print the label correctly if I reconfigure the request for JSON, passing a single JSON item.

    Am I missing something? Should I be able to pass multiple records using the BTXML example above?

    Thanks.

    Steve

    0
  • Avatar
    Jason Reibel

    Does anyone have an answer to Steve's question? I would like to implement a similar integration.

    0
  • Avatar
    Jasper Wen
    版主

    The BTXML data that Steve Williams has in his previous post looks correct. It could be something that is set incorrectly in the Integration or BarTender document.

    For anybody that is running into issues, feel free to reach out to us at tech support here.

    0
  • Avatar
    Permanently deleted user

    Hi.  It's 4 years later.  We have BT 2019 Enterprise .. is there a way to do multiple labels from JSON now ?

    0
  • Avatar
    Michael Höller

    Anything new on this topic? I really need this!

    0

登入寫評論。