/

 

The manual

Self-training

Experimentation

Contact

 

Language

Validating the entry of a customer code

Suppose we define our customers via a contact form like this one (as a reminder, the screenshots below were taken in organize mode which shows the name of each field in light gray):

and that we have defined a state which lists the contact files (whose identifier will be noted 'xxx / yyy / zzz' in the program a little further).

We can then modify the customer file seen in the article 'The files and their programs' as follows:

The fields 'customer' and 'company' are part of a table with one row and two columns whose edges are hidden.

By adding a virtual button (here 'Virtual button: change_client') in the properties of the 'client' field as shown below:

Then by adding a program to the form, with the following code:

if button_name="change_client"
  societe := lookup "xxx/yyy/zzz" client societe client

In the end, we obtain that each time the operator fills in the 'customer' field with a customer code, the 'company' field is automatically updated, thus allowing the operator to check that the code indicated is correct.

Note: at the level of the properties of the 'company' field, it is advisable to indicate 'Can be modified in mode: never' so that it is clear to the operator that the value of the 'company' field is not to grab.

Here is how the final version of the form appears in edit mode: