Article ID: 121684, created on May 21, 2014, last review on May 21, 2014

  • Applies to:
  • APS 2.x

Symptoms

I'm trying to display data in aps/Grid, to do this I call custom operation and feed it into aps/Memory but there is an error:

TypeError: invalid 'in' operand context
context = (p in context ? context[p] : (create ? context[p] = {} : undefined));

Cause

aps.js library expects data property for aps/Memory to be an array of objects, it attempts to iterate over it to extract the data:

getProp = function(/*Array*/parts, /*Boolean*/create, /*Object*/context){
var p, i = 0, dojoGlobal = dojo.global;
if(!context){
    if(!parts.length){
        return dojoGlobal;
    }else{
        p = parts[i++];
        try{
            context = dojo.scopeMap[p] && dojo.scopeMap[p][1];
        }catch(e){}
        context = context || (p in dojoGlobal ? dojoGlobal[p] : (create ? dojoGlobal[p] = {} : undefined));
    }
}
while(context && (p = parts[i++])){
    context = (p in context ? context[p] : (create ? context[p] = {} : undefined));
} 

Most probably data is a string.

Resolution

Verify that result of querying the store are in proper JSON format.

70bf700e0cdb9d7211df2595ef7276ab 717db81efe94e616312b74fb03a5d474

Email subscription for changes to this article
Save as PDF