Description:
Modify the field values of a record.
Syntax:
r.modify(xi:Fi,…)
Note:
The function modifies the field values in record r.
Parameter:
r |
The record to be modified. |
xi |
Modification expression. |
Fi |
Name of the field to be modified. The ith field in r will be modified if Fi isn’t supplied. |
r' |
The new record that will replace record r. |
Option:
@r(r') |
Replace record r with record r' according to the former’s order. |
@f(r') |
Modify a certain field value of record r with record r'. |
Return value:
Record
Example:
|
A |
|
1 |
=[[1,"Lucy",29]].new(~(1):ID,~(2):Name,~(3):Age) |
|
2 |
=A1(1).modify(2,"Petter") |
Modify the first and the second field.
|
3 |
=A2.modify(30:Age) |
Modify Age field.
|
4 |
=A3.modify(3,33:Age) |
Modify the first field and Age field.
|
5 |
=[[4,"Lily",23]].new(~(1):SID,~(2):SName,~(3):SAge) |
|
6 |
=A4.modify@r(A5(1)) |
Fill members of A5(1) in A4 according to A4’s order.
|
7 |
=A6.modify@f(([["ella"]].new(~(1):Name))(1)) |
Modify only the value of Name field in A6.
|
Related function: