# Partial update on item in array within an object - suggestion

**URL:** <https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385>\
**Category:** Ask us anything\
**Created:** [May 1, 2024, 11:40am UTC](https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385 "2024-05-01T11:40:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Pederson](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mark_pederson/32/14758_2.png) [@Mark\_Pederson](https://community.weweb.io/u/Mark_Pederson)\
**Post date:** [May 1, 2024, 11:40am UTC](https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385/1 "2024-05-01T11:40:12Z")

</div>

@Alexis @Quentin @flo

When you select an array for a partial update - you get field options for **INDEX, PATH & VALUE**.

When you select an object for a partial update - you get field options for **PATH & VALUE**.

So, if you want to update an item in an array WITHIN an object - you need to resort to custom javascript.

What would be the IDEAL no-code approach??

When you select an object as the variable - WeWeb checks to see if there is an array(s) within the object - and if there is - it give you a field to bind / define the **ARRAY** (within the object) - followed by the **INDEX, PATH & VALUE**

Further - this **ARRAY** field could be OPTIONAL so user could still target a value in the object that is not in an array if the object contains both value outside of arrays and within arrays in the root of the object.

---

<div class="post-metadata">

**Author:** ![FHEXL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/fhexl/32/13607_2.png) [@FHEXL](https://community.weweb.io/u/FHEXL)\
**Post date:** [May 1, 2024, 9:13pm UTC](https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385/2 "2024-05-01T21:13:21Z")

</div>

I don’t quite understand all of your question. But looking at: So, if you want to update an item in an array WITHIN an object - you need to resort to custom javascript.

I would take a look at the Weweb object and array formulas.

For example:

- Fetch the array in the object: getKeyValue
- Find the index of the array item you want: findIndexByKey
- Update item: Partly update array using the found index

---

<div class="post-metadata">

**Author:** ![Mark\_Pederson](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mark_pederson/32/14758_2.png) [@Mark\_Pederson](https://community.weweb.io/u/Mark_Pederson)\
**Post date:** [May 1, 2024, 10:37pm UTC](https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385/3 "2024-05-01T22:37:57Z")

</div>

It wasn’t really a question - more of a UI suggestion so that doing a partial update to an array (remove one item at a specific index, etc) that is within an Object - could be super simple and more intuitive -

Here is little mockup I made - so, IF the object contains an array(s) - you can select them from a drop down and target.

Of course you can ultimately do pretty much ANYTHING with formulas and custom JS - but WeWeb as a product is a nocode front end EDITOR - so IMO - WeWeb should always be working to make things EASIER in the editor.

 ![mockup_object](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/bbaefd6e38a4b7a30e5cde317d34e1d5246af451.png)

---

<div class="post-metadata">

**Author:** ![Alexis](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexis/32/13248_2.png) [@Alexis](https://community.weweb.io/u/Alexis)\
**Post date:** [May 2, 2024, 3:24pm UTC](https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385/4 "2024-05-02T15:24:37Z")

</div>

> [@Mark\_Pederson](#):
>
> When you select an object as the variable - WeWeb checks to see if there is an array(s) within the object

This subject has already be discussed and I understand the need. It’s not that easy UX wise because the variable is not always filled when you’re editing it. And the sub property  
could also be sometimes null, sometimes an array. We can detect it on a weweb variable because they are typed, it’s more complicated and confusing in term of UX when the property type can change depending of when you are editing it

---

<div class="post-metadata">

**Author:** ![Mark\_Pederson](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mark_pederson/32/14758_2.png) [@Mark\_Pederson](https://community.weweb.io/u/Mark_Pederson)\
**Post date:** [May 2, 2024, 3:57pm UTC](https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385/5 "2024-05-02T15:57:11Z")

</div>

> [@Alexis](#):
>
> It’s not that easy UX wise because the variable is not always filled when you’re editing it. And the sub property could also be sometimes null, sometimes an array.

Understood re: “not that easy” - I just find the current Action \> “Change a variable value” to be super easy for updating a simple object or array - but then it’s a show stopper when when you want to quickly do partial updates on arrays within objects. (unless I am missing something and someone wants to show me the “easy way”).

I am pretty sure you guys could come up with a clever UX solution - even if it means having a different, separate Action "“Change a variable value - advanced” that is more focused on this use case - if you want to preserve the current UI/UX of “Change a variable value”

---

<div class="post-metadata">

**Author:** ![Alexis](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexis/32/13248_2.png) [@Alexis](https://community.weweb.io/u/Alexis)\
**Post date:** [May 2, 2024, 4:28pm UTC](https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385/6 "2024-05-02T16:28:57Z")

</div>

What if we provided each available actions as a formula ? Would you still find it more difficult / less handy ?

 ![Capture d’écran 2024-05-02 à 18.25.40](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/bec9b40608d6a1bc46173e6e0b7bfff3290d518f.png)

I agree there is a need for improvement in this use case, I will fill an internal product ticket so we can discuss it with the product team 🙂

---

<div class="post-metadata">

**Author:** ![Mark\_Pederson](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mark_pederson/32/14758_2.png) [@Mark\_Pederson](https://community.weweb.io/u/Mark_Pederson)\
**Post date:** [May 2, 2024, 4:39pm UTC](https://community.weweb.io/t/partial-update-on-item-in-array-within-an-object-suggestion/8385/7 "2024-05-02T16:39:53Z")

</div>

> [@Alexis](#):
>
> What if we provided each available actions as a formula ? Would you still find it more difficult / less handy ?

**Well that would would be WAY less painful than right now!** And you should fast track that if you can for sure.

But, obviously an elegant, simple nocode UI/UX for this would be a great feature IMO. One of the reasons I love XANO so much is that their SET & GET filters are very simple for facilitating manipulating / updating variable objects - regardless of complexity - easy and fast.
