Datadefinitions import data into existing objects

I have a feed with image URL’s I want to import into DAM and link into existing objects.

This feed has the primary key of these existing objects.

When I import this feeds Datadefinitions is making new objects. How can I import data from two feeds into the same object?

create two definitions and run them one after another

Hi,

I did this. I made two definitions where the second definition only imports images and set the primary key.

and is it working now?

Hi Dominik,

My reply was not very good, apologies :).
It is not working. I made two definitions where the second definitions only imports images and set the primary key. When I run the second feed with this definition the import is creating new objects instead of updating the exisiting objects with image.

do you use the same primary identifier for both definitions?

Hi Dominik,

No, I use a different one in the second feed because the second feed doesn’t contain the primary identifier the first feed contains.

But I guess this should’t be a problem because it should match on selected primary key.

Yes, as long as the Objects have the same value in the field you check for primary, you should be fine. So for example, you have these kinds of csv files:

File 1:

key1 key2 name
blub blub2 Any Blub

File 2:

key2 asset
blub2 image.jpg

You should be able to define key1 for import 1 as Primary Identifier and Key 2 for Import 2 as Primary Identifier. You need to have at least a unique value that matches somehow the same object in the two imports.

It’s working now. Guess I made some misconfiguration before.

One more question. I can now import one image to the productimage component when there is one image but I can’t import multiple images to the image gallery.

I use the assets_url interpreter for this.

The feed looks like this:

id;name;images
1;product1;https://www.x.x/image1.jpg, https://www.x.x/image2.jpg
2;product2;https://www.x.x/image3.jpg, https://www.x.x/image4.jpg

What am I doing wrong here?

You have to use a combination of interpreters for that:

  • nested
  • expression: explode(’,’, value)
  • iterator:
    • expression: trim(value)
    • asset_url

What it does:

First, you configured a stack of interpreters with the “nested” interpreter, that then splits up the URLS, iterates them with the “iterator” interpreter, trims the value, and calls asset_url on it. The iterator interpreter expects the value to be an array and also returns an array

I did the following:

Now I get:

Error: Variable “’” is not valid around position 9 for expression explode(’,’, value).

Guess I need to change value to something else because normally you do this with explode?

Yes, explode should be fine. you got a CSV where inside the column, you separate urls by comma. But I have no idea about the error…

asset url should be inside the iterator as well,

so:

iterator: nested

  • expression with trim
  • asset_url

I changed it now like this:

But still this error:

Here is a row of the feed I try to import:

“Home > Kussens > Effen kussens”;“Kussen Fluffy lichtgrijs 45x45cm”;https://www.x.nl/wp-content/uploads/2019/06/Kussen-Fluffy-lichtgrijs-45x45cm.jpg;"https://www.x.nl/wp-content/uploads/2019/06/Kussen-Fluffy-lichtgrijs-45x45cm-zijkant.jpg,https://www.x.nl/wp-content/uploads/2019/06/Kussen-Fluffy-lichtgrijs-45x45cm-op-stapel-met-kussens.jpg,https://www.x.nl/wp-content/uploads/2019/06/Kussen-Fluffy-lichtgrijs-45x45cm-detail.jpg,https://www.x.nl/wp-content/uploads/2019/06/Kussen-Fluffy-lichtgrijs-45x45cm-achterkant.jpg "

Look at the error message, you are using an invalid char in your expression config. Don’t use `, use " or ’

We are getting somewhere :slight_smile: . I changes the expression to ". Now the images are imported into DAM, but those aren’t attached to the products yet what seems pretty strange to me.

Am I still missing something?

There was a bug in an older version of data-defs, what version are you using?

3.0.5:

Hi Dominik,

Do you have any suggestion left?

sorry, no. Could be anything now…