Skip to Content
Jun 17, 2016 at 09:18 AM

exit an array loop on condition becomes true


Hi Friends,

I am running an array loop on employee, and if I find the headcount data to be zero anywhere in the loop then it should activate the my BEX condition.

I am able to achieve this functionality but at the same time it is unnecessarily completing the entire loop and then stopping.

Can we have functionality of exiting the array loop as soon the first condition is satisfied so as to bypass the unnecessary iteration or do we have any other approach of not using array loop and find out if the key figure has a value zero for any employee.

var members = DS_1.getMembers("0EMPLOYEE",100);

var headCount = 1.00;

members.forEach(function(element, index)


headCount = DS_1.getData("00O2TLJS35QG17XOPIOEFDCF2",

{"0EMPLOYEE": element.internalKey}).value;

if (headCount == 0)


DS_1.setMeasureFilterActive("00O2TLJS35QG17XQAZO55P6U0", true);

// Can we have an exit function over here to exit the loop



Please suggest.