< Back
Print

Process HTML table Format Plugin


This format plugin contains two options. One is used to convert an array into a HTML table and the other one to convert an HTML table into an array.
HTML Table Format plugin configuration options

 

Converting an array into a html-table

Important: The structure of the array needs to be like this:
 
[“row_1” => [“column_1” => “value”], “row_2” => [“column_1” => “value”]]
 
Every key on the first level needs a sub-array as value. In the end, for each array from the first level one row in the table will be created. The table head is the key from the second array.

Example:
For this example we will use the loop head plugin to export images with their names and ids.
Example Datamap configuration with loop head format plugin to create an array
We configure the loop to our preferences and in the “Format of the source value” choose “Create an array”. This array will then create the rows in the table for each loop pass.
Example Loop head configuration with array as format plugin
Just to show an example of the array, let’s have a look at the debug entry when running the job.
Debug for the array that should be converted into an html table
Now we can select the “Process HTML table” format plugin as “Format of the result value” and then select “Convert an array to an HTML table” as course of action in the plugin configuration. You can also add CSS classes to the table to later access the style (e.g. when displaying the table on a website).
The CSS classes are added to the table-tag
Use HTML Table format plugin to create a html table form an array
Output looks like this:
Output of the converted array to html table

 

Converting a HTML table to an array

When working with tables this process is very simple. For example when you have an attribute in contentserv storing a table like this:
HTML Table as attribute in contentserv
 
The structure of the table in HTML looks like this:
Contentserv attribute html table structure
 
Now select the attribute with the “Process HTML table” format plugin in a datamap row.
Convert the HTML table to an array with the HTML table format plugin
 
This will give you the following output
Output of the converted html table to an array

 

 

Was this article helpful?
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents