Change Variable Value - Partial update of an array within object

Hi there, I’ve hit an issue trying to update an item in an array within an object variable using partial update.

Here is the Object with the element I’m trying to update highlighted:
And I’ve added the relative path in the formula

I can see that I’m targeting the correct element, as the result is being read correctly, however when testing, the element is not updating. I feel like I’m making a rookie mistake here. Any advice would be most helpful. :wink:

Hi! I have two thoughts:

  • The update is pretty deep in you object structure. Maybe the “Partial Update” has a limit. If so, you can do this via Javascript
  • You are using different indices (item.parent.parent.index, item.parent.index and item.index). Are you sure this is correct?

Hey Max, thank you for your feedback,

Based on the object structure i think the indices correspond accordingly:
item.index = ratings
item.parent.index = bars
item.parent.parent.index = data

I can use partial update formula to update items at the first level, but I can’t seem to update items at 2nd or 3rd.

I’ll try the JS route as per your suggestion.

Odd,

There has just been a application maintenance and now the item menu has disappeared!

I now have no access to the scope of the current item.

Are you trying to update a value in a collection item? area_attribute_result_object if so, that’s not how you’d do it.

They are read only afaik. You’d need to make an update call to your backend.

Go to custom javascript and do this

[area_attribute_result_obj.data][item.parent.parent.index].bars[item.parent.index].ratings[item.index].result = true

or if you have it within the context, you can directly target the result, you might see it there

[result] = true

if you want to do it via path, you gotta do it like a string I think. Now you are changing

[area_attribute_result_obj]false

1 Like

Thanks Broberto,

Super helpful … using Custom Javascript worked. Using the context item made it super simple too.

context.item.data.result = true

Big thanks :slight_smile: :star_struck:

1 Like

I know this is old topic. This problem stole my whole afternoon, but I found a solution.
For anyone who want to stick with no-code way, and don’t want to go custom Javascript.

Since this hero mentioned that the “path” property of the partial update uses RELATIVE path. I solved that by convert the whole dynamic relative path to a string, then return it :grinning:.