Access form object values by programming

Automatically translated from English

An increasing number of developers are using the Form command to link their form objects and many of you require easy programming access to the values of those objects. So, to help you access the value of a form object, regardless of its variable or expression, we’ve added two new commands: OBJECT Get value and OBJECT SET VALUE.

Let’s see how to use them!

OBJECT get value

To get the value of a form object, use the OBJECT Get value command with the name of your form object as a parameter.

For example, to get the value of the current object:

C_VARIANT($value)
$value:=OBJECT Get value(OBJECT Get name(Object current))

OBJECT SET VALUE

In the same way, to set the value of a form object, use the OBJECT SET VALUE command with the name and the new value as a parameter.

For example, to set a new value for the current object, just write:

OBJECT SET VALUE(OBJECT Get name(Object current);"New value")

With just a single command (OBJECT SET VALUE), you can change the form object’s value! 4D even checks if it is an assignable expression or a variable and sets the value when possible.

Fabrice Mainguené

• Product Owner •

Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.

After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.