How to send Data as collection to the api/actions which will help to create table in the Label design
I am using the below API to print the Label
POST |
/api/actions |
To submit a script to run in the server |
While Designing the Label Template, few static fields I can create NamedDataSources and use it to define the template, If I wanted to create table with collection data which has more than 1 row, how should i send the data in this API, how will I use those data collection
-
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 thedata
orfields
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
Iniciar sesión para dejar un comentario.
Comentarios
1 comentario