ASSIGN values from an entry to FIELDSET

You can fill FIELDSET with all database fields from an entry in a single statement by assigning this entry to the FIELDSET. This clears the FIELDSET and then creates a field in the FIELDSET for each database field in the entry. Numerical database fields are converted to text using the function number with two decimal positions (see number).

There are two ways to assign an entry to FIELDSET:

  • Use the identification in a FORALL/WITH loop.

    FORALL X0 IN EXP.Customers DO 
      FIELDSET Customer := X0 
    OD 

    In this example, the program loops through the records in the EXP.Customers entry and assigns the fields from each EXP.Customer record to the FIELDSET Customer during the loop. This construction can be used with both singular and plural entries.

  • Assign a specific record directly to the FIELDSET using a WHERE clause.

    ASSIGN FieldSet_x := EXP.Customer WHERE PAR(1) = 1002 
    

    In this example, the command retrieves the entry Customer for the customer 1002. If a record is retrieved successfully, it creates a Field for each database Field in this entry in the FIELDSET FieldSet_x and fills it with the value from the record. Only singular entries can be assigned to a FIELDSET using the WHERE clause.

    FIELDSET assignments are generated during the compilation of the Master Template. If the entry changes in the DID, the Master Template has to be recompiled to reflect these changes.