Newer Version Available

This content describes an older version of this product. View Latest

Multi-Value Field

A multi-value field contains more than one value.

Example

One typical use case for multi-value fields is security. For example, you can have a dataset that contains various accounts, and each account has multiple owner IDs. We’ve created a sample dataset called OppRoles where OwnerId is a multi-value field.

Account ID Amount Owner.Name Opportunity ID Owner ID Stage
001R00000046CHdIAM 1,900,013 Emily Dickinson 006R0000002OF6eIAG 005R0000000VU9bIAG, 005R0000000VU9bIAH, 005R0000000VU9bIAI Closed Won
001R00000046CV6IAM 70,449 Albert Einstein 006R0000002OF6eIAG 005R0000000VU9UIAW, 005R0000000VU9bIAG, 005R0000000VU9UIAX 005R0000000VU9UIAY Closed Won
001R00000046CI6IAM 4,206,995 Indiana Jones 006R0000002OF6eIAG 006R0000002OF6gIAG, 005R0000000VU9RIAW, 005R0000000VU9SIAW Closed Won

This query filters on an OwnerId to display only the accounts that it can access.

1q = load "OppRoles";
2q = filter q by 'OwnerId' == "005R0000000VU9bIAG";
3q = foreach q generate 'AccountId' as 'AccountId', 'Amount' as 'Amount', 'Id' as 'Id', 'Owner.Name' as 'Owner.Name', 'OwnerId' as 'OwnerId', 'StageName' as 'StageName';
Account ID Amount Owner.Name Opportunity ID Owner ID Stage
001R00000046CHdIAM 1,900,013 Emily Dickinson 006R0000002OF6eIAG 005R0000000VU9bIAG Closed Won
001R00000046CV6IAM 70,449 Albert Einstein 006R0000002OF6eIAG 005R0000000VU9bIAG Closed Won
The OwnerID value 005R0000000VU9bIAG has access to two of the three accounts, so two of the accounts are displayed.

Limit multi-value field use to filtering only. Multi-value fields can behave unpredictably with group and foreach.

Important