Use XLS Export Action without Database

How to export form data to XLS without using a database in ChronoForms.

Overview

The XLS Export Action typically requires database data, but users need to export custom arrays directly.
Create a sub-array within the form data object and reference it in the Data Path field of the XLS Export Action.

Answered
mo monochrome 10 Jun, 2015
Hi,
is searched the forum, but didn´t find a solution:
is there a way to use the XLS Export Action without database and write the form input data directly?

if not, is there a way pass my own array to the XLS Export Action?

Something like this:
Custom Code field:

var $myarray = array('field1' => 'Content1', 'field2 =>'content2'); 


XLS Export Action
Data Path: $myarray ( Is this right?)
Fields list: field1,field2


Any hint would be great!

Thanks for your help,
Thorsten
Gr GreyHead 10 Jun, 2015
Answer
1 Likes
Hi Thorsten,

Please try a sub-array like this
$form->data['myarray'] = array (
  [0] => array(
    'field1' => 'some value',
    'field2' => 'some other value',
    ...
  ),
   [1] => array(
    'field1' => 'banana',
    'field2' => 'apple',
    ...
  ),
  . . .
)
then put myarray (no $) in the Data Path box.

Bob
mo monochrome 10 Jun, 2015
Hi Bob,

thanks for your answer! It works like a charm with a little correction:

$form->data['myarray'] = array (
  '0' => array(
    'field1' => 'some value',
    'field2' => 'some other value',
    ...
  ),
   '1' => array(
    'field1' => 'banana',
    'field2' => 'apple',
    ...
  ),
  . . .


Thanks for your help,
Thorsten
This topic is locked and no more replies can be posted.