FlattenGrid
Converts categorical loop sub-questions (both grid and non-grid) into flattened questions that can be used in the DMOM event OnBeforeJobStart/OnAfterMetaDataTransformation.
Syntax
FlattenGrid(FlattenQuestionFullName, FilterIteration, MDMObject)
Parameters
FlattenQuestionFullName
Type: string
FullName for the question being flattened
FilterIteration
Type: string
String for the iteration filter
MDMObject
Type: object
MDM object related to the .mdd file that contains GridObjectName
(return)
Type: string
True if the function is successful.
Notes
The generated questions are saved on the top level in the .mdd file related to MDMObject. The policy for avoiding duplicate question names is to append _1, _2, _n to the default question name.
Examples
FlattenGrid("MyLoopCatQuestion.rating", Null, MDMObject)
The definition for MyLoopCatQuestion is as follows:
MyLoopCatQuestion - loop
{
A "A",
B "B",
C "C",
D "D"
} fields -
(
rating categorical [1..1]
{
LikeABit "LikeABit",
Like "Like",
Dislike "Dislike"
};
) expand grid;
The generated, flattened questions are as follows:
A_rating categorical
expression("MyLoopCatQuestion[{A}].rating");
B_rating categorical
expression("MyLoopCatQuestion[{B}].rating");
C_rating categorical
expression("MyLoopCatQuestion[{C}].rating");
D_rating categorical
expression("MyLoopCatQuestion[{D}].rating");
FlattenGrid ("MyLoopCatQuestion.rating", "a,b", MDMObject)
Then newly created variables are as follows:
A_rating categorical
expression("MyLoopCatQuestion[{A}].rating");
B_rating categorical
expression("MyLoopCatQuestion[{B}].rating");
FlattenGrid ("ComplexLoop.Grid1", "a,b", MDMObject)
The definition for ComplexLoop is as follows:
ComplexLoop - loop
{
A "A",
B "B",
C "C",
D "D"
} fields -
(
Grid1 - loop
{
1 "1",
2 "2",
3 "3"
} fields -
(
rating categorical [1..1]
{
ABitLike "ABitLike",
Like "Like",
Dislike "Dislike"
};
) expand grid;
) expand grid;
The generated, flattened questions are as follows:
ComplexLoop_A_1_rating categorical
expression("ComplexLoop[{A}].Grid1[{1}].rating");
ComplexLoop_A_2_rating categorical
expression("ComplexLoop[{A}].Grid1[{_2}].rating");
ComplexLoop_A_3_rating categorical
expression("ComplexLoop[{A}].Grid1[{_3}].rating");
ComplexLoop_B_1_rating categorical
expression("ComplexLoop[{B}].Grid1[{_1}].rating");
ComplexLoop_B_2_rating categorical
expression("ComplexLoop[{B}].Grid1[{_2}].rating");
ComplexLoop_B_3_rating categorical
expression("ComplexLoop[{B}].Grid1[{_3}].rating");
See also