Update linked data from another table without overwriting - automatically with make

Are you using our SaaS platform (Baserow.io) or self-hosting Baserow?

SaaS

What do you need help with?

So there is this post: How to import and link data to existing tables using Make automation which is very useful. Its limit is the fact that it tells how to CREATE A ROW with linked data taken from another table, and not to how to UPDATE A ROW without erasing previous values.

I tried to find a way, but it overwrites the linked value in my table. So using the example in the link, my contacts can have multiple companies associated with them and I would like to UPDATE the row of a single contact by ADDING a new company while leaving intact the companies already there. So no overwriting.

I appreciate if someone can help with this.

@frederikdc could you please help out with this question? :pray:

It has been a long time since I used Make, but it looks like you need some additional steps.

A link to table field always holds a list of values. If you want to update a record, the link to table fields must contain a list of id’s. Those id’s refer to the records in the linked table. For example: the field Contacts can have the value [34,5,76] where each number represents the id of a contact.

What you need to do in Make is map the original value of the Contacts field that will look like

[
{"id": 34, "value": "contact 1", order: 1.00000},
{"id": 5, "value": "contact 2", order: 2.00000},
{"id": 76, "value": "contact 3", order: 3.00000}
]

and make sure it will look like [34,5,76].

The next step is adding the id of the new item you want to add. For example: item with id 412.

Finally, you assign [34,5,76,412] to the updated Contacts field.

1 Like

ok so I just need to pass multiple row IDs instead of only one.

I first fetch the already present row IDs, then I transform them as you said and pass the value [already-present-row-id, already-present-row-id, already-present-row-id, new-row-id-to-be-added]

I will try during the next days, thanks for replying!

How to map that JSON output into something like that? I don’t know which module to use.

Also, the structure [1,2,3] is not accepted into that Make field. It accepts a single number (the row id), but I don’t know what to write to pass multiple row IDs. I did some manual test writing by myself [1,2] for instance. It should have assigned row id 1 and row id 2 for that contact but Make said it is invalid input.

I did like this: (not working)

From the above input, if I leave the [1,2] and disable the MAP toggle, I see:

And I understand why this won’t work, square brackets are all over the place.

Instead, if I try to input values like this:

It does work.

From that view, if I toggle MAP again, I get:
image

but saving and executing while MAP is on and values are 1,2 does not work.

I also made a post in Make.com about this: I pass an array but Make refuses telling me it wants a uinteger - Getting Started - Make Community

From my testing, I tried to map using multiple formats: arrays, collections, strings, but that map field always gives me the


BundleValidationError
Validation failed for 1 parameter(s).
Invalid number in parameter 'KeyProduct'

I am starting to think it is a bug of Update a Row Baserow Make module. One way to bypass this is to make an API call updating a row and passing the raw array.

This is just to tell that prior to mapping the previous IDs as discussed here, the format [1,2] plus a lot of other formats do not work.

I solved like this:

1 Like