How to loop through the records with condition - Forum - Rollbase - Progress Community

How to loop through the records with condition

 Forum

How to loop through the records with condition

This question is answered

Hi Folks,

For the server side script implementation, how to do the looping for all the records that satisfy the conditions of an object in rollbase? 
Please make me clear on this.

Thanks in advance.

Ithrees

Verified Answer
  • Hi ithrees

    Here is sample example on how to do the looping for all the records that satisfy the conditions of an object in rollbase.

    var arr = rbv_api.selectQuery("select firstName from ssapinew1_emp where lastName=?",10,lname); ---------- >this will return array of firstNames

    var buff = "Name:"

    for (var i=0; i<arr.length; i++) {            

    buff += arr[i][0]+", ";

    }

    rbv_api.setFieldValue("ssapinew1_emp", "{!id}", "ssapinew1_selquery", buff);

    Note : Although we have some tokens using which you can work on loops , however it is not suggestable.

    You can refer to the documentation for more details.

    documentation.progress.com/.../index.html

    Hope you find this useful.

    Thanks,

    Sharavan

All Replies
  • Hi ithrees

    Here is sample example on how to do the looping for all the records that satisfy the conditions of an object in rollbase.

    var arr = rbv_api.selectQuery("select firstName from ssapinew1_emp where lastName=?",10,lname); ---------- >this will return array of firstNames

    var buff = "Name:"

    for (var i=0; i<arr.length; i++) {            

    buff += arr[i][0]+", ";

    }

    rbv_api.setFieldValue("ssapinew1_emp", "{!id}", "ssapinew1_selquery", buff);

    Note : Although we have some tokens using which you can work on loops , however it is not suggestable.

    You can refer to the documentation for more details.

    documentation.progress.com/.../index.html

    Hope you find this useful.

    Thanks,

    Sharavan