Importing into Playa fields with DataGrab
This is a quick tutorial on how to import into Playa fields using DataGrab (v1.6+)
The first import
Firstly, we’ll import our initial set of data into the News channel. Here we are using a CSV file called dummy.csv.
Configure the import
We’ll just fo a simple import, setting the Title, Entry Date and Body fields of the entry
Results of the first import
We now have 3 new entries in the News channel.
The second import
In this import we’ll use an XML file called dummy.xml. We want to relate these entries to the entries we have just imported (using the Playa field), so the entries in this file all have a field that contains the titles of the entries that they should be related too (eg, Two)
Configure the second import
As with the first we have set up a simple import, but with the addition of the Playa field.
In the Playa field we choose which field in the data source describes the relationship. In this case the field ‘related/title’ contains the name(s) of the titles from the first import.
Note that you can use another field other than the entry’s title to match on. You could use the entry’s id or another custom field if that is a better option (eg, a Product’s unique identifier)
The final results
When we run the second import it creates new entries and adds any Playa relationships it finds.