Multivalue Field

A multivalue field contains more than one value.

Example 

One typical use case for multivalue 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 multivalue field.

Account IDAmountOwner.NameOpportunity IDOwner IDStage
001R00000046CHdIAM1,900,013Emily Dickinson006R0000002OF6eIAG005R0000000VU9bIAG, 005R0000000VU9bIAH, 005R0000000VU9bIAIClosed Won
001R00000046CV6IAM70,449Albert Einstein006R0000002OF6eIAG005R0000000VU9UIAW, 005R0000000VU9bIAG, 005R0000000VU9UIAX 005R0000000VU9UIAYClosed Won
001R00000046CI6IAM4,206,995Indiana Jones006R0000002OF6eIAG006R0000002OF6gIAG, 005R0000000VU9RIAW, 005R0000000VU9SIAWClosed Won

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

1q = load "OppRoles";
2q = filter q by 'OwnerId' in ["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';

When using comparison operators in the filter, use in and not in to return the correct values. Using == and != returns unexpected values when null handling is enabled. See Group-by with Null Values for more information.

Note

Account IDAmountOwner.NameOpportunity IDOwner IDStage
001R00000046CHdIAM1,900,013Emily Dickinson006R0000002OF6eIAG005R0000000VU9bIAGClosed Won
001R00000046CV6IAM70,449Albert Einstein006R0000002OF6eIAG005R0000000VU9bIAGClosed Won

The OwnerID value 005R0000000VU9bIAG has access to two of the three accounts, so two of the accounts are displayed.

Limit multivalue field use to filtering only. Multivalue fields can behave unpredictably with group and foreach.

Important

See Also