Back to all How-tos

Using the new PHP Array option with COTG

In this How-To we’ll explore in detail the new Use PHP Array feature added in Workflow 8.5. Though seemingly unasuming, this feature has quite a bang for your buck: in fact, it will make processing HTTP Post data exponentially easier. When used in conjunction with COTG templates in Connect 1.5, which integrates those changes, you’re in for a treat.

COTG is absolutely not necessary to take advantage of this feature! It will work with any HTTP Post data, whatever the source.

Step 1: Enable the option

The first thing we must do is enable the option in the Workflow preferences:

  • In Workflow, head over to The Button at the top left of the interface.
  • Then, at the bottom, click on Preferences.
  • Head over to the HTTP Server Input 1 section
  • Check the Use PHP Arrays option.
  • Click OK to save the preferences
  • Send the configuration to the service, and make sure it restarts.

Step 2: Make a Template

In Connect designer, we’ll need to create a template that takes advantage of the new feature – simple enough, it’s already integrated into the new templates generated by Connect! Simply create a new template using the Capture OnTheGo Starter Templates. The easiest one to test this on is the Time Sheet template which already contains a dynamic table displaying this feature. Clicking on the Add button in the timesheet table creates a new input item in the array, readable by the Workflow feature.

Otherwise, here’s how to create your own template to take advantage of this new feature.

  • Create a new template from any of the Foundation templates
  • Add a Form element if one does not exist in the template
  • Go in the Insert menu, COTG Form Element, Fields Table…
  • The ID of the table determines what name the nodes will have in your HTTP Server Input process.
  • Add new form elements within the left part of the table

Obviously, you will have to adjust the design to your own needs. The default Fields Table contains a single <td> cell, which will need to be expanded if you want more (in much the same was as the Time Sheet template).

Get the XML Envelope

To simplify the process of creating data mapping configurations and Workflow processes from data generated by a form, a 3rd feature was added in 1.5.

  • Ensure that the Workflow services are up and running with the Use PHP Array feature turned on.
  • In the Toolbar, click on the Get Job Data File on submit icon to toggle the feature on.
  • Go to the Live tab in the Workspace
  • Fill in some form data (in this instance, click on the Add button and enter some data in the new table rows)
  • Click on Submit.
  • In the Save As dialog, save the XML file retrieved in a folder of your choice.

Data mapping configuration and Workflow process

The final step is of course to use either DataMapper or Worklow to actually use the new data you’ve just obtained.

Here’s an example data file from a simple, single-input repeating table:

<?xml version="1.0" encoding="windows-1252"?>
<request type="POST">
  <paths count="0"/>
  <values count="19">
        <description>Hours 1</description>
        <description>Project X</description>
  <files count="0"/>
    <user-agent>Jakarta Commons-HttpClient/3.1</user-agent>

Capture OnTheGo data cannot be entered directly within Designer, which explains empty elements above. The important part of course is that the <worksheet_table> node contains multiple <row> nodes with each their own instance of each input field.

These are just the basics of course, remember to brush up on your Capture OnTheGo course for implementation details, and the Connect courses on

Leave a Reply

Your email address will not be published. Required fields are marked *