RECORD (FirstMember, Member...) RECORD (FirstMember; Member...)

FirstMember

The first member. Its name is the name you give this parameter.

Member

An additional member. Its name is the name you give this parameter.

Returns

Record Record

A value whose members are the given parameters, each named by the name given to the parameter.

Returns a value which bundles other values together, each under a name you choose. RECORD (Kind: "Shirt", Price: 29) RECORD (Kind: "Shirt"; Price: 29) returns a single value with two members, Kind and Price .

Members are read using ! , in the same way that the parts of anything else are read:

RECORD (Kind: "Shirt", Price: 29)!Price
RECORD (Kind: "Shirt"; Price: 29)!Price

That formula returns 29.

The names are written before a colon, as when naming a parameter to any other function. The difference is that these names are yours to choose. Most functions accept only the parameter names they themselves offer, whereas RECORD takes its names from the formula you write.

A record is a single value

A record is one value, which means it can be returned, passed to a function and used wherever a single value is expected. That is what makes records useful: several related values can be kept together instead of being tracked separately.

IF can return a record, and the members of the result can be read regardless of which branch was taken:

IF (NumberValue > 10, RECORD (Kind: "Large", Price: 99), RECORD (Kind: "Small", Price: 29))!Kind
IF (NumberValue > 10; RECORD (Kind: "Large"; Price: 99); RECORD (Kind: "Small"; Price: 29))!Kind

Only the members which both records offer can be read from such a result. If one record offers a member the other does not, that member is not available, as it would be missing if the other branch were taken.

Members holding errors

A member holding an error does not make the whole record an error. The other members can still be read. This formula returns "Hat", even though the price of a hat cannot be found:

RECORD (Kind: "Hat", Price: XLOOKUP ("Hat", { "Shirt", "Jacket" }, { 29, 149 }))!Kind
RECORD (Kind: "Hat"; Price: XLOOKUP ("Hat"; { "Shirt"; "Jacket" }; { 29; 149 }))!Kind

Reading the Price member of the same record returns the #N/A error returned by XLOOKUP.

Building a table from records

An array of records is a table, where each record is a row. TABLE builds one from a column at a time, which is usually easier than writing the rows out.

Examples

RECORD (Kind: "Shirt", Price: 29)!Kind
RECORD (Kind: "Shirt"; Price: 29)!Kind

Returns "Shirt", the value of the Kind member.

RECORD (Kind: "Shirt", Price: 29)!Price
RECORD (Kind: "Shirt"; Price: 29)!Price

Returns 29, the value of the Price member.

RECORD (Kind: "Shirt", Price: 29 * 2)!Price
RECORD (Kind: "Shirt"; Price: 29 * 2)!Price

Returns 58. A member may be given any formula, not only a literal value.

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell