Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Array Context variable,getting an array from the context

Not applicable

I have a context variable that is an array of complex objects, but when I read it comes broken.

var newArrayVar = [];
newArrayVar = context.getVariable('arrayVariable.content');


print("Lenght:"+ newArrayVar.length);
print("newArrayVar: "+ newArrayVar);
for (i = 0 ; i < newArrayVar.lenght; i++) {
   print("inside loop");
}

The expected output is something like this:

Length: 5
newArrayVar: [{....},{...},...]
inside loop
inside loop
inside loop
inside loop
inside loop

But I get this:

Lenght:348549
newArrayVar: [{....},{...},...]  //THIS IS PROPERLY PRINTED

This only happens with an array set in the context, when I just place one object, it works fine.

The object itself contains arrays inside.

0 1 1,062
1 REPLY 1