Multi-valued fields
Most fields are able to to store a single value, such as a number or a word. Multi-valued fields, however, can store multiple values, which assist in the following cases:
You can configure Event, Feedback, and K-fields as multi-valued fields taking the following into account:
-
For Event and Feedback fields, once you have set a field to be multi-valued, they can't be reverted back to a single-value field.
-
Multi-valued K- fields must be calculated either Manually or On-demand.
-
You cannot use Date or Date and time data types with multi-valued fields.
Note the following additional characteristics of Multi-valued fields:
- Multi-valued field values appear as a dot-delimited list in Responses reports.
-
When used in a report with a calculation of Count, splits on multi-valued fields show the count of each value. The Total column continues to show the total number of records, which is likely to be less than the sum of the multi-valued field counts. To avoid confusion for report users, omit the Total column from reports where Count is used for multi-valued fields.
-
Multi-valued fields export in CSV format.
-
Medallia Experience Cloud stores values mapped to a single multi-valued field in order, but does not retain null values.
-
Multi-valued Feedback fields cannot be added to survey episode conditions or Rapid response conditions. These should be addressed using K- fields.
-
Even though Multi-valued fields store raw data as
'Value A, Value B', custom query syntax is as follows:fieldName = 'Value A' AND fieldName = 'Value B'(instead offieldName = 'Value A, Value B'). -
An Event field can be converted into a Multi-valued Event field only if:
-
Used it for Duplicate Checking is not checked.
-
Used it for Anti-Cheating Engine is not checked.
-
It is not internal or part of either a root or vertical company.
-
Its Data type is either Integer, Text, Email, Indexed, Unit, Choice set, Fractional. When using Medallia Alternative set, its Content kind must be Integer, Long , Short integer, Text, Email, Autoindexed text, IP Address, Unit, Enumeneration, Dynamic Alt Set, Real number, and Fractional.
-
-
Multi-valued field Alternative sets must use the Dropdown FormKind instead of the default value of Radio button. If the FormKind remains Radio button, form choices intended to be multiple selection are instead single selection.
Consolidating Multiple fields (Yes/No)
When using the legacy Multiple fields element, consider its possible fields:
What problem(s) did you experience during your stay?
-
Noise.
-
Guest room cleanliness and condition.
-
Bathroom.
-
Staff service and attitude.
-
Internet.
-
Room temperature.
-
Billing.
With single-value fields, you must create separate Yes/No question for each of the individual problems. As a result, each question must be reported separately. Using a multi-valued K- field, you can group all of these fields into the same field, where each of the fields is reported as a single choice set value. You can add the consolidated K-field to Profiler and Ranker modules, for example, where the report splits on the different choices. You can also split on the field in custom modules. To consolidate each question into a multi-valued K-field, use the list function in your K-field. For example:
list(
seqnum(q_problem_noise) == 1 ? 1 : null,
seqnum(q_problem_cleanliness) == 1 ? 2 : null,
seqnum(q_problem_bathroom) == 1 ? 3 : null,
seqnum(q_problem_staff) == 1 ? 4 : null,
seqnum(q_problem_internet) == 1 ? 5 : null,
seqnum(q_problem_temperature) == 1 ? 6 : null,
seqnum(q_problem_billing) == 1 ? 7 : null
);
That K-field maps values to the following choice set values or sequence numbers:
| Value | Sequence number |
|---|---|
| Noise | 1 |
| Guest room cleanliness and condition | 2 |
| Bathroom | 3 |
| Staff service and attitude | 4 |
| Internet | 5 |
| Room temperature | 6 |
| Billing | 7 |
The K-field checks to see if any of the problem fields have a sequence number of 1 (Yes), and if so, returns the associated sequence number of that alternative.
for-loop to access the sequence numbers of each item in the array as follows: var mvFieldArr = list(q_problem_noise);
var seqnumArr = [];
//Obtain the sequence number. Format should be seqnum(arr[i]);
for (i = 0; i < mvFieldArr .length; i++) {
seqnumArr.push(seqnum(mvFieldArr[i]));
}Setting user data access (intersection versus union)
Ordinarily, if you give users access to 2 Unit groups or segments, their data scope is the intersection of the 2. It is easy to configure the intersection, but it is difficult to give users access to the union of the unit group and segment (Unit group/segment1 + Unit group/segment2). You can use multi-valued fields to create the unions, which you can then use to set users' data scope.
First, create the union using the same K- field list functionality described in the previous section. In the following example, a user should be associated with a record if their email address is recorded in one of 3 email fields (representing 3 different levels of the hierarchy at which they might be working on the account):
With the union created, you can give users access based on that K-field. For example:
<output-column>
<input-column heading="Email"/>
<target-field fieldId="primary_role_access" fieldName="primary_role Access" requiredness="REQUIRED" type="PERMISSION">
<survey-field-permission-field-parse-options fieldId="k_b2b_rc_users_currentownersgroup">
<enumerated-field-parse-options mappingKey="NAME" />
</survey-field-permission-field-parse-options>
<javascript-transform><![CDATA[
userEmail = value;
return noWhitespace(lower(userEmail));
]]></javascript-transform>
</target-field>
</output-column>
Configuring Multi-touch units
Without multi-valued fields, if you want to associate a survey with multiple Units (an association known as Multi-touch), you must create a new unit field for every additional unit you want associated with survey records. For example, for a record to be associated with 3 different accounts, you need 3 separate unit fields. If the company later wanted to associate survey records with a fourth unit, you would need to create a fourth unit field, and then add the associated mappings to that field. Multi-valued unit fields allows for associating surveys with as many units needed (as specified in the invitation file), and which allow the unit mapping to occur in a single field.
This section considers the following scenarios:
-
Unit identifiers provided in the same field.
-
Unit identifiers provided in separate fields.
Unit identifiers provided in the same field
A company's invitation file might include unit identifiers of 3 accounts (for example,101, 102, and 103) in a single field, and delimited by commas. In this example, assume you had previously added those units into the organizational hierarchy, prepended with the constant identifier [ACCOUNT]. The 3 unit identifiers you need to associate with survey records are:
-
[ACCOUNT] 101.
-
[ACCOUNT] 102.
-
[ACCOUNT] 103.
You can achieve this through the following JavaScript, which splits account identifiers into individual values based on commas, prepends the value [ACCOUNT] to each value, and then joining the list back together (using commas as a delimiter). The string is passed into a multi-valued unit field and (as a result of the delimiter="," code) the prepended list is split and mapped to the 3 units.
<output-column>
<input-column heading="Account IDs"/>
<target-field fieldId="e_mv_unit" fieldName="MV Unit" requiredness="OPTIONAL" type="UNIT">
<enumerated-field-parse-options mappingKey="IDENTIFIER" delimiter="," />
<javascript-transform><![CDATA[
var accountIds = value;
if (hasContent(accountIds)) {
var units = accountIds.split(",");
for (var i = 0; i < units.length; i++) {
units[i] = "[ACCOUNT]" + upper(units[i]);
}
accountIds = units.join(",");
return noWhitespace(accountIds);
}
discardRecord('\'Account IDs\' field is missing');
]]></javascript-transform>
</target-field>
</output-column>
A limitation of this approach is that a multi-valued unit field cannot be used as the primaryUnitFieldId (set on the survey-processor-options element in Auto Importer). As a result, you must also include a regular unit mapping in your survey spec prior to the multi-valued unit mapping. For example, the following code takes the first unit identifier passed in the list, and maps it to the Unit ID (e_unitid) field:
<output-column>
<input-column heading="Account IDs"/>
<target-field fieldId="e_unitid" fieldName="Unit" requiredness="OPTIONAL" type="UNIT">
<enumerated-field-parse-options mappingKey="IDENTIFIER" />
<javascript-transform><![CDATA[
var accountIds = value;
if (hasContent(accountIds)) {
units = accountIds.split(',');
primaryUnit = noWhitespace(units[0]);
return "[ACCOUNT]" + primaryUnit;
}
return null;
]]></javascript-transform>
</target-field>
</output-column>
You can then include the multi-valued unit mapping directly after this mapping in Auto Importer, so each record is mapped correctly to the appropriate units:
<output-column>
<input-column heading="Account IDs"/>
<target-field fieldId="e_unitid" fieldName="Unit" requiredness="OPTIONAL" type="UNIT">
<enumerated-field-parse-options mappingKey="IDENTIFIER" />
<javascript-transform><![CDATA[
var accountIds = value;
if (hasContent(accountIds)) {
units = accountIds.split(',');
primaryUnit = noWhitespace(units[0]);
return "[ACCOUNT]" + primaryUnit;
}
return null;
]]></javascript-transform>
</target-field>
</output-column>
<output-column>
<input-column heading="Account IDs"/>
<target-field fieldId="e_mv_unit" fieldName="MV Unit" requiredness="OPTIONAL" type="UNIT">
<enumerated-field-parse-options mappingKey="IDENTIFIER" delimiter="," />
<javascript-transform><![CDATA[
var accountIds = value;
if (hasContent(accountIds)) {
var units = accountIds.split(",");
for (var i = 0; i < units.length; i++) {
units[i] = "[ACCOUNT]" + upper(units[i]);
}
accountIds = units.join(",");
return noWhitespace(accountIds);
}
discardRecord('\'Account IDs\' field is missing');
]]></javascript-transform>
</target-field>
</output-column>
split(",") logic.Unit identifiers provided in separate fields
A company might provide unit identifiers in different columns of the import file. One way to handle this is to concatenate the fields into a comma-delimited list in JavaScript before passing them through the same function outlined in the previous example.
Alternatively, you can use the multiValuedMode="APPEND" function (on the target-field element) to map records to all of the units. For example, the import file might include the following row and columns:
|
Survey ID |
Account ID 1 |
Account ID 2 |
Account ID 3 |
|---|---|---|---|
|
12345 |
101 |
102 |
103 |
Begin by mapping the first value to a regular unit field:
<output-column>
<input-column heading="Account ID 1"/>
<target-field fieldId="e_unitid" fieldName="Unit" requiredness="OPTIONAL" type="UNIT">
<enumerated-field-parse-options mappingKey="IDENTIFIER" />
<javascript-transform><![CDATA[
var unitId = value;
if (hasContent(unitId)) {
return "[ACCOUNT]" + unitId;
}
return null;
]]></javascript-transform>
</target-field>
</output-column>
Then use the same multi-valued unit field to append the rest of the unit identifier mappings. The following code shows how the full mapping might appear:
<output-column>
<input-column heading="Account ID 1"/>
<target-field fieldId="e_mv_unit" fieldName="MV Unit" requiredness="OPTIONAL" type="UNIT">
<enumerated-field-parse-options mappingKey="IDENTIFIER" />
<javascript-transform><![CDATA[
var unitId = value;
if (hasContent(unitId)) {
return "[ACCOUNT]" + unitId;
}
return null;
]]></javascript-transform>
</target-field>
</output-column>
<output-column>
<input-column heading="Account ID 2"/>
<target-field fieldId="e_mv_unit" fieldName="MV Unit" requiredness="OPTIONAL" type="UNIT" multiValuedMode="APPEND">
<enumerated-field-parse-options mappingKey="IDENTIFIER" />
<javascript-transform><![CDATA[
var unitId = value;
if (hasContent(unitId)) {
return "[ACCOUNT]" + unitId;
}
return null;
]]></javascript-transform>
</target-field>
</output-column>
<output-column>
<input-column heading="Account ID 3"/>
<target-field fieldId="e_mv_unit" fieldName="MV Unit" requiredness="OPTIONAL" type="UNIT" multiValuedMode="APPEND">
<enumerated-field-parse-options mappingKey="IDENTIFIER" />
<javascript-transform><![CDATA[
var unitId = value;
if (hasContent(unitId)) {
return "[ACCOUNT]" + unitId;
}
return null;
]]></javascript-transform>
</target-field>
</output-column>
