DataGrab and Matrix fields

» Visit the DataGrab support page

Notes on using DataGrab to import into Matrix fields.

This is a holding page to add notes regarding importing data into a Matrix field.

Preliminary support for Pixel & Tonic’s Matrix is available in DataGrab 1.7.0 and above. Please consider this support as a Beta until further notice.

Version details

  • DataGrab version 1.7.1
  • Matrix version 2.2.4 Earlier versions will not work.

Configuring the import

Configuring the import

The results

The resulting matrix field

Matrix cell types

The beta version currently supports text, date and file cells. Support for other cell types to follow.

Date fields can be formatted in any recognisable date format (YYYY-MM-DD HH:MM:SS is recommended)

Images/files should be uploaded manually to an existing File Upload area and the filename in the data source should be prefixed with the Upload area variable (e.g., /images/uploads/filename.png if filename.png is in the upload area with the id of 1)

Supported data types

CSV and XML imports are supported. I’ll document these better as the beta progresses. Feel free to contact me in the meantime if you need help.

Example data format are:

XML

<products>
    <
product>
        <
title>PRODUCT4</title>
        <
sku>D</sku>
        <
description>Lorem ipsum dolor sit amet...</description>
        <
items>
            <
item>
                <
sku>D1</sku>
                <
label>TwoA</label>
                <
image>{filedir_1}bnb5.png</image>
                <
rel></rel>
                <
date>2012-03-01</date>
            </
item>
            <
item>
                <
sku>D2</sku>
                <
label>TwoB</label>
                <
image>{filedir_1}bnb1.png</image>
                <
rel></rel>
                <
date>2012-03-01</date>
            </
item>
        </
items>
    </
product>
</
products

ie, repeating item elements can be imported into a Matrix. Select the first item in the configuration pulldown, and DataGrab will add the rest

CSV with Matrix rows on separate lines of the file

ID1,"PRODUCT1","Blah, blah, blah.",A1,"OneA","{filedir_1}bnb1.png","","2011-12-11",12.99
ID1
,"PRODUCT1","Blah, blah, blah.",A2,"OneB","{filedir_1}bnb2.png","","2011-12-11",13.99
ID1
,"PRODUCT1","Blah, blah, blah.",A3,"OneC","{filedir_1}bnb4.png","","2011-12-11",14.99 

In the settings assign a unique id (eg, product id) to a custom field. Use that field to check for duplicates and check the Update existing entries setting.

CSV with matrix rows as comma delimited values in a cell

E;"PRODUCT5";"Blah, blah, blah.";"E1,E2";"ThreeA,ThreeB";"{filedir_1}bnb3.png,{filedir_1}bnb2.png";"2011-11-04,2010-11-16" 

Note, that the 4th to 7th columns each have 2 comma-separated values. Each value will be assigned to a new matrix row.

Known problems

Please consider this Beta level software. Features may not work and may change in future releases.

 

 Download our free add-ons