Relationships
Last updated
Last updated
If you're using Publisher, and the Publisher DataGrab Connector, unfortunately Relationship fields inside of a Grid field do not import. We have not been able to find a working solution and apologize for the inconvenience.
Firstly, we’ll import our initial set of data into the News channel. Here we are using a CSV file called dummy.csv.
We’ll just fo a simple import, setting the Title, Entry Date and Body fields of the entry
We now have 3 new entries in the News channel.
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 relationship 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)
As with the first we have set up a simple import, but with the addition of the relationship field.
In the relationship 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)
When we run the second import it creates new entries and adds any relationships it finds.
If you are importing entries and want to assign multiple related entries to it, you can pass a pipe delimited string of entry IDs for each relationship to create. For example if 3|10|23
is the value of one of the CSV columns, JSON or XML nodes, and you mapped that field to a Relationship field in ExpressionEngine, then the imported entry will be assigned 3, 10, and 23 assigned as a relationship.