Skip to Content
0
Sep 13, 2016 at 02:19 PM

DS Scripting: How we can access the whole result set (line by line)?

47 Views

Hi,

We are wondering how it's possible to write the complete result set of a DataSource into an (multidimensional) array in order to have access on existing characteristic relations. The only way we could find was a nested loop with getMembers and getData statements:

var arMaterial = DS_OVERVIEW.getMembers("0MATERIAL", 10000);
var arPlant = DS_OVERVIEW.getMembers("0PLANT", 10000);

arMaterial.forEach(function(elMaterial, ii) {
  arPlant.forEach(function(elPlant, jj) {
    if (DS_OVERVIEW.getData("A3R23AAT4HMDGHPUIYXEIWL8O", {"0MATERIAL": elMaterial.internalKey, "0PLANT": elPlant.internalKey}).value == 1)  {
          // Do something
    }
  });
});

This works but is not very fast if we have a multiple entries in each array. Also we are producing a lot of warning messages like 'No matching data found" or "Could not find member xyz of dimension 0MATERIAL"...

Does anyone knows a better solution for such an access on the whole result set?

Best Regards,

Alex