Dot notation + object field = issue

Hey,

I’m facing this weird problem in many 4D 17 versions. I assume it is a bug even if I cannot imagine I could be the first to discover it.

The code is so simple: after saving a new record if I do not use at least one OB SET command the line with id property is not saved.

<code 4D>
CREATE RECORD([Table_1])
[Table_1]Resultat_O:=New object(“test”;1)
[Table_1]stamp:=String(Current date;ISO date GMT;Current time)
SAVE RECORD([Table_1])

If (Shift down)
OB SET([Table_1]Resultat_O;“debug”;True)
End if
[Table_1]Resultat_O.id:=1
SAVE RECORD([Table_1])
UNLOAD RECORD([Table_1])

BEEP

</code 4D>

Here is a one metho demo: https://forums.4d.com/4DBB_Main/x_User/3906/files/29610005.7z

Hello,

Please read the doc :

https://doc.4d.com/4Dv17/4D/17.1/Using-object-notation.300-4179432.en.html (Initialization)

Regards,

O,

Yes the field is already well initialized at line 2 and properties are saved before the first SAVE RECORD

The problem occurs after the first SAVE RECORD

Yes, I’ve read your code. But after your first SAVE RECORD your object is no more initialised …by chance it’s works as it’s necessary. That’s not a bug, just a normal behaviour.

https://doc.4d.com/4Dv17/4D/17.1/4D-field-types.300-4201109.en.html (Saving Object fields)

Thank you,

The right code:

<code 4D>
CREATE RECORD([Table_1])
[Table_1]Resultat_O:=New object(“test”;1)
[Table_1]stamp:=String(Current date;ISO date GMT;Current time)
SAVE RECORD([Table_1])

[Table_1]Resultat_O.id:=1
[Table_1]Resultat_O:=[Table_1]Resultat_O

SAVE RECORD([Table_1])
UNLOAD RECORD([Table_1])

BEEP

</code 4D>