'Add object property to all list items'

I use objects in my lists a lot. Whenever I want to add a new property to the objects, I have to add it by hand for all the items in the list. Instead, whenever I add a property, could Thunkable identify whether it is in a list and give a popup/alert to ask whether I want to add that property to all object-items in the list? That would really help me, and many others I’m sure.

2 Likes

Please my workaround Thunkable

When the app starts, it creates 3 objects with name and gender as properties. The middle object has an extra property, age.

When the button is clicked, the property age is added to the other two objects.

I added a list viewer to see the properties of the first object before and after the change.

Hope this helps.

1 Like

Hi @muneer , thanks for the workaround. This is not exactly what I was talking about. I was talking about objects that I have in the code. For example, I want to store user information, so I initialize a variable with the object
Name: “”
Age: 0
Password: “”

Then while I am coding the app, I realize I want to store gender too in my variable. So I want to be able to add properties for objects across my code, not within the app. Hope I explained it clearly.

1 Like


Look at this: I have a list of objects with the properties name, width, height, and background. Now I realized I wanted to add a property ‘Visible’ to each item of this list, but now I have to add it to each item manually. I was asking the staff if they could add a feature which allows us to automatically add a property to all objects in a list. Hope I was clear this time. Thanks

1 Like

OK, I got you. Apologize for the misunderstanding.
You mean you want this property to be added to the variable across your coding blocks.
I assumed a different thing.

1 Like

Please don’t apologize. Yes, that’s what I meant, see the example given above.

1 Like

I went through a similar situation. I ended up saving my objects to Firebase and then used a similar block that I shared to add new properties.

You could do the same with stored variable, too.

1 Like

Thats a great approach! It’s not absolutely necessary at the moment, but the next time I’m in this situation, I’ll do it this way. Thanks!

1 Like

@jane would it be possible to add this feature? No hurry, it just helps me thunk quicker.

1 Like

You can make a feature request in our public Github repo. Find more info here: Report Bugs and Submit Feature Requests in Our Public Github Repository

2 Likes

Thanks @jane, done that.

2 Likes