With the object notation, available as a preview in 4D v16 R4, your code is simpler to write, easier to read and more natural to think. That is true. But did you really see the full potential of the object notation?
Before 4D v16 R4, when you wanted to create a detail form to enter contact information from an object field, you had no choice but to write an expression like OB GET ([CONTACT]Info; “City”) in the variable data source. You could retrieve the attribute value, but it was not possible to change it. Moreover, you had to write a loadRecord method with the OB GET command for each attribute and a saveRecord method with the OB SET command for each attribute.
What does object notation change in this scenario? From 4D v16 R4, you just write [CONTACT]Info.City in the variable data source! This variable is available in Read/Write mode. OB GET and OB SET commands are no longer necessary. That’s it! Now you see the full potential.
Where can I use the object notation?
Of course, Method Editor is the first place where it can be used. To find all details about this new syntax, take a look at this post. But there is more than that, object notation is bringing additional benefits as explained below.
In Form Data Source
You can now use object notation in form object data source! Thus, it becomes easier to create a detail form.
As you see in the example, you can now directly access a field object attribute: [Person]OB_Field.Firstname.
There are several advantages of using object notation and no longer an expression (i.e. using OB Get command):
- The attributes are now in Read/Write mode. When the user enters a value in the form, the attribute value is updated.
- You can use standard actions to navigate in the record selection: Next Record, Save Record, etc…
You can also use the object notation in the debugger. In the custom watch pane, you can add an attribute of an object field or variable, to directly see its current value. Please take a look at this video to see what the new possibilities are.