Creating a string from an array
I have an array of data pulling into a project containing a list of items. I want to place it in a text box and have been trying various methods to do this:
array list = ["apples","pears","oranges"]
I want this to display as such::
apples
pears
oranges
This below code works but obvious just lists them including columnns
window.cpAPIInterface.setVariableValue('outputvariable',list);
output - apples,pears,oranges
Several various codes work fine if I enter them in chrome console but will not work when included in advanced action javascript in an excercise:
resultstring = data['Items'].join("\n");
window.cpAPIInterface.setVariableValue('outputvariable',resultstring);
for (var i = 0; i < list.length; i++) {
resultstring = resultstring + list + "\n";
}
window.cpAPIInterface.setVariableValue('outputvariable',resultstring);
and even a basic:
resultstring = list[0] + "\n" + list[1] + "\n" + list[2];
window.cpAPIInterface.setVariableValue('outputvariable',resultstring);
ALL three of those work using the chrome console but will fail if used within captivate itself.
Any clues?