跳至主內容

搜尋

搜尋

How to send Data as collection to the api/actions which will help to create table in the Label design

評論

1 條評論

  • Avatar
    mathew jacob

    To send collection data (with more than one row) for a table in your label template via the /api/actions API, you should structure your data as an array of objects, where each object represents a row in the table. This can be sent in the API request body as part of the data or fields payload. Each object in the array can include the values corresponding to the table columns. In your label template, you would then reference the collection data using a loop or dynamic table tags to iterate through the rows. Here's an example structure for the API request:

    {
      "action": "printLabel",
      "data": {
        "tableData": [
          {"column1": "Value1", "column2": "Value2"},
          {"column1": "Value3", "column2": "Value4"},
          {"column1": "Value5", "column2": "Value6"}
        ]
      }
    }
    

    In your template, use dynamic fields to loop through tableData and fill the rows accordingly. Ensure the template is designed to handle dynamic content like tables, which will automatically display multiple rows based on the collection data.

    0

登入寫評論。