Skip inside the for each loop

Hi All,

Consider a scenario where  ,I am looping on an array of 100 values.

I got the value which i was looking at the index of 20 . then i need set 2 variables with predefined values and skip rest of the looping in for each.

Could you please let me know if it is possible ? sample code is really appreciated .

Thanks in advance

Raj

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Hi Benjamin , Thanks for the reply .
    I am not trying to update the array itself . I need to update a cdt or a local variable which is defined in load or with if if the condition defined in expression of for each met and skip the loop. Any other loops will it help ?

    Ex:

    local!a : {"1","2","3","4","5","6","7","8","9","10"}
    local!toset,
    local!sampleJsonObj: "{ 1:null,2:null,3:null, 4:India, 5:australia, 6:null,7:spain,8:null,9:yyyy,0:jjjjj}" /*this array holds json objects with more than 100 */

    For ex: a!forEach(
    items:local!a,
    expression: if ( not (isnull ( index (samplejsonObj, fv!item )) , set the first index value / json object of not null to a local toset or cdt , else skip the next values)
    )

    hope it is clear with pseudo code.

    Thanks
    Rajesh