Creates an object from arrays of keys and values.
createvalueobjectbyhashes(keys, values)
| Parameter | Type | Description |
|---|---|---|
keys |
Array | Array of property names |
values |
Array | Array of values |
Object - New object with key-value pairs.
The createvalueobjectbyhashes function creates an object by pairing up arrays of keys and values. Each key is matched with the value at the same index.
Keys = ["name", "age", "city"]
Values = ["John", 30, "NYC"]
Result = CREATEVALUEOBJECTBYHASHES(Keys, Values)
// Result: { name: "John", age: 30, city: "NYC" }
Headers = ["id", "product", "price"]
Row = ["001", "Widget", "9.99"]
Record = CREATEVALUEOBJECTBYHASHES(Headers, Row)
PropertyNames = OBJECTKEYSTOARRAY(Template)
PropertyValues = GeneratedValues
NewObject = CREATEVALUEOBJECTBYHASHES(PropertyNames, PropertyValues)
- CSV processing: Convert rows to objects
- Data transformation: Build objects dynamically
- Mapping: Create lookup tables
- Import: Convert flat data to objects
- objectkeystoarray - Extract keys
- objectvaluestoarray - Extract values
- generatearrayofobjectsfromsets - Generate multiple objects
- Arrays should have same length
- Uses the Logic service's
createValueObjectByHashesmethod