Setting a Display view for Elements Connect field is optional; however, it might make big difference especially for the performance. We won't get into the details above as it's all explained in the Display View Configuration page.
In the Display View, we access the field Key through the $currentCustomfieldValue Velocity variable.
Suppose we have a user picker Elements Connect field, Live Text type.
If the user was allowed to select single value in the Edit view, setting the Display View will be easy and direct by using the $currentCustomfieldValue variable.
If the user was allowed to select multiple values in the Edit view, setting the Display View will be by using the $currentCustomfieldValue variable and a function that will handle the multiple values; otherwise, only the first value will be displayed.
The below screenshot, demonstrates an Elements Connect field with multiple value selection. Therefore, to access the field Key in the Display query, we need to use the $currentCustomfieldValue variable with of the function intList(), stringList(), or serialize(<string>). All details about these functions could be found in our documentation.
Case 1: The Key stores multi integer values
If the Key was set on the id (integer number), the display query will looks like:
This is an example of the field Display View configuration.
Case 2: The Key stores multi strings (characters) values
If the Key was set on the user_name (characters), the display query will looks like:
This is an example of the field Display View configuration in this case.