Partial update on item in array within an object - suggestion

@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.

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

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.

1 Like

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

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”

1 Like

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

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 :slight_smile:

1 Like

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.