Using "This.value" with a scalar collection listbox and edit a row

Hello,

I wonder if other people experiment this issue.

I use a scalar collection in a listbox and display the values thanks to “This.value” in my listbox column expression. When I edit a value in the listbox, the collection linked is not updated automatically.

If I set programatically the value, it work good (thanks to the bug fix ACI0099322), but it will override the change I have made by hand in my column.

[]29576689;“Issue.”[/]

https://forums.4d.com/4DBB_Main/x_User/2049408/files/29576707.zipBug Base test_lb_coll.zip>

unlike languages (JavaScript) where every variable is an object,

scalar values in 4D are not objects, meaning This.value can not be a reference to the original property.

it must be a copy.

Does it mean we should consider that behavior as a standard behavior?

So we cannot edit a scalar collection within a listbox and must handle the edited value ourself?

Didn’t noticed that this ir working.

You should always use objects as rows:

<code 4D>
Form.data:=New collection
Form.data.push(New object(“value”;“Data1”))
Form.data.push(New object(“value”;“Data2”))
Form.data.push(New object(“value”;“Data3”))
Form.data.push(New object(“value”;“Data4”))
Form.data.push(New object(“value”;“Data5”))
</code 4D>

Then it will work:

https://forums.4d.com/4DBB_Main/x_User/277254/files/29591333.7z

Thank you,

Yes it works when we use objects with a “value” attribute, I was wondering if it is a standard behavior or not that we cannot edit a scalar collection within a listbox.

the doc states:

https://doc.4d.com/4Dv17R4/4D/17-R4/This.301-4054233.en.html

Note: If you use a collection of scalar values in a listbox, 4D creates an object for each element with a single value property. Thus, the element value is available through the This.value expression.

“creates” implies that the object is a copy, not reference, because the original element (scalar) is not an object.

“value” implies that the property is only useful for reading, not updating.

: Keisuke MIYAKO

the doc states:

https://doc.4d.com/4Dv17R4/4D/17-R4/This.301-4054233.en.html

Note: If you use a collection of scalar values in a listbox, 4D
creates an object for each element with a single value property.
Thus, the element value is available through the This.value
expression.

“creates” implies that the object is a copy, not reference, because
the original element (scalar) is not an object.

“value” implies that the property is only useful for reading, not
updating.

I never saw this reference. I only got the one from https://doc.4d.com/4Dv17R4/4D/17-R4/Managing-List-Box-Objects.300-4054554.en.html#Paragraph_3784338Collection or Entity Selection type list boxes> where a small statement states : 4D Doc

(or This.value in case of a collection of scalar values).

The explanation from the “This” command gives more informations. So I will look to work with that.

Thank you