Professional > Data management scripting > Data Management reference > Data Management functions > CombineIterations
 
CombineIterations
Combines the response value for nested grid question iterations (used for OnNextCase events).
Syntax
CombineIterations(CombineQuestion, CombineIterationName, CombineList)
Parameters
CombineQuestion
Type: object
Grid question
CombineIterationName
Type: string
The iteration category that stores the combination results.
CombineList
Type: Categorical
The iteration category items that determine the result.
Return value
Type: Boolean
True if the function is successful.
Notes
Used to combine the value of sub-question(s) related to two iterations (by union operation). The results are saved in the sub-question related to another iteration named CombineIterationName.
There are restrictions when using this function:
CombineQuestion is categorical loop.
The loop can contain more than one type of sub-question. This function only process categorical questions.
Iteration CombineIterationName should exist in question CombineQuestion before the OnNextCase event. The iteration can be added via the .dms script metadata.
Example
CombineIterations(MyLoopCatQuestion, "NetAorB", {A,B})
NetAorB is one iteration category for MyLoopCatQuestion, and can be added as follows:
MetaData (ENU, Analysis, Label, myInputDataSource)

MyLoopCatQuestion - loop
{
NetAorB "Respondent chose either A or B"
} fields -
(
rating categorical [1..1]
{
LikeABit "LikeABit" Factor(3),
Like "Like" Factor(2),
Dislike "Dislike" Factor(1)
};
) expand grid;

End MetaData
After running the function, the results are as follows:
Iteration Name
Case 1
Case 2
A
{ ABitLike }
{ Dislike }
B
{ Like }
{ Dislike }
NetAorB
{ ABitLike , Like }
{ Dislike }
See also
Data Management functions