0

I want to get some results from MasterData with a query. I see no errors or something else whats so ever. The debugger just stops at queryMasterData. No results are shown.

The function i am calling:

$local:getSparepartsSearch = function(searchString)
{
  pool = $masterdata:'com.movilizer.bottler.sparepartresources.location.99.employee.S031';
  group = "ALL";

  filter = {
    'col' : 'key';
    'op' : 'startswith';
    'val' : searchString;
  };

  returnArray = {
    'result' : 'all';
    'order' : {
        'key' : 'A';
    };
    'limit' : 1000;
    'offset' : 0;
  };

  spareparts = queryMasterData(pool, group, filter, returnArray);
  for(i:spareparts)
  {
    sparepartData = spareparts[i]['data'];

    for(j:sparepartData)
    {
        key = j;
        value = sparepartData[j];
        result[i][key] = value;
    }
  }
  return result;
};
Bohemian
  • 412,405
  • 93
  • 575
  • 722
Pavel Kotlov
  • 544
  • 4
  • 11
  • What do you mean by the "debugger stops" ? The whole client is hanging up and crashing? Or it simply jumps over your iteration and does not display any results? The later seems to indicate that your query does not return any results at all. – André Schäfer Mar 18 '15 at 15:46
  • Well i would excepct that if the query returns no results at all that the debugger would jump in the next row. The debugger just stop doing MEL after this row. so for me it seems that some form of exception was thrown. – Pavel Kotlov Mar 18 '15 at 15:51
  • also strange things happen in the debugger my MasterData pools disappear after the calling of this method. – Pavel Kotlov Mar 18 '15 at 15:53
  • 1
    MEL executions being interrupted in the middle of a block normally indicate exceptions. You can add try catch exception handling around the suspicious pieces. Also it might be an idea to run simple tests with simplified filters and / or result settings. This might allow to identify a problem in these two params – André Schäfer Mar 18 '15 at 15:55
  • Hm this request, as you can plainly see, is as simple as it gets... – Pavel Kotlov Mar 18 '15 at 15:56
  • Far from it ... returnArray = { "result" : "all" }; ... would be "as simple as it gets" – André Schäfer Mar 18 '15 at 15:57

1 Answers1

0

could you please add more information, how does your movelet look like? Which screenTypes are you using and how are you trying to display the data (screen changes or change events)?

I had a look into workspace to find a closer example, in the past I've created a zip code search by an existing pool of zip codes. In my example I've used an text item screen which returned me the matching numbers with the start value of at least 2 digits.

if(length(value) ?ge 2)

{ addAnswer($answer:'q0a1', '0', 'Output: ');

pool = $masterData:'PostCode';
group = 'FrenchDealer';
filter = 
{
    'col':'key';
    'op':'startswith';
    'val':value;
};

keyword = queryMasterdata(pool, group, filter,{ "result":"all";});

for(i:keyword)
{
    for(j:keyword[i]['data'])
    {
        addAnswerItem($answer:'q0a1', '0', '0', j, conCat(keyword[i]['data'][j]['CITY'], '(', keyword[i]['data'][j]['COMMUNE'], ')'));
    }

    addAnswer($answer:'q0a3', '0', 'matched:');

    str = conCat(i, '\n', str);
    setAnswerValueByClientKey($answer:'q0a3', '0', str);
}

$local:addedDropDown = true;

}

lrs_coolik
  • 81
  • 6