Цитата:
INIT
Use these functions to initialize a record in a C/SIDE table.
Record.INIT
recordref.INIT
Record
Data type: record
The record you want to initialize. This function assigns default values to each field in the record. The values the system assigns in the record correspond to those defined when the table was created. If no value was assigned when the table was created, the system assigns values based on the data type, as shown in this table:
If the data type is...
The default value is...
Boolean
No
Option
0
Integer
0
Decimal
0.0
Date
0D (Undefined date)
Time
0T (Undefined time)
Code
'' (empty string)
String
'' (empty string)
recordref
Data type: recordref
The recordref that is used to identify the record that you want to initialize
Comments
The system does not initialize primary key or timestamp fields.
After the system executes this function, you can change the values in any or all of the fields before you call the INSERT function to enter the record in the table. Be sure that the fields that make up the primary key contain values that make the total primary key unique. If the primary key is not unique (record already exists), the system rejects the record.
Example
These C/AL examples show how to use the INIT function. Assume that the primary key includes the "No." field:
Scenario 1
Customer.INIT;
Customer."No." := '1120';
Customer.INSERT;
Scenario 2
Customer."No." := '1120';
Customer.INIT;
Customer.INSERT;
Since INIT does not initialize the primary key fields, the order of the statements in situation 1 and 2 is not important. Situation 1 causes the same result as situation 2.
Или нужен перевод?