Populating more than 1000 objects from a collection

254 views
Skip to first unread message

banerjee...@gmail.com

unread,
Jul 23, 2015, 2:24:26 AM7/23/15
to Fujitsu RunMyProcess Developer Community
Hi Team,

In my application for the department field there around 1800 plus values, so i was trying to list the values, the way it is shown in documentation, for this i created a CAPI with the following code

<#function list_all_objects pattern collection_name index>
<#assign list = list_objects(pattern,collection_name,index*1000,1000)>
<#if (list?size = 1000)>
<#assign list = list?eval+ list_all_objects(pattern,collection_name,index+1)>
<#return list>
<#else>
<#return list?eval>
</#if>
</#function>
<#assign my_pattern={}>
<#assign my_collection_name = "MY_IM_Department">
<#assign entries= list_all_objects(my_pattern,my_collection_name,0)>
<#assign vb_department=[]>
<#list entries as x>
<#assign vb_department=vb_department + [{"lable":x.department,"value":x.department}]>
</#list>
${vb_department}


To trigger the CAPI in my web interface i am using the below code

function rmp_set_vb_list_value(vb_name,vb_value) {
var a = new RMP_List();
a.fromArray(vb_value);
RMPApplication.setList(vb_name,a);
return true;
}

id_list_values_from_collection.trigger({},{},
function(result){
/* OK*/
rmp_set_vb_list_value("vb_department",result.vb_department);
},

function(error){
/*ko*/
alert("error while loading the list");
});

Now the issue is when i tested the CAPI it is picking all the 1800 plus values , but when i am triggering it into the web interface it is not picking up any values, i.e the list is empty.

So please tell me where i am doing wrong? please help.

Pankaj Kumar

unread,
Jul 23, 2015, 5:28:24 AM7/23/15
to suppor...@runmyprocess.com
Hi Somjeet,

Please check the data you are receiving or simply the length of the array (result.vb_department), Since you are getting result in running the test mode of the CAPI, so most likely the issue can be populating the RMP List.

Also Please share the error details, you can check it pressing the "F12" key in browser.

Please find the sample code of populating the List from array:-

Sample Code:-

function set_list_names(vb_name,p_widget) {
return function (result) {
var vb_car = new Array();
for(i=0;i<result.length;i++) {
vb_car.push({"label":result[i].name,"value":result[i].car_id});
}
// set the name of the variable of the variable based list
p_widget.setListVariableName(vb_name);
// set the value of the variable of the variable based list
var a = new RMP_List();
a.fromArray(vb_car); 
RMPApplication.setList(vb_name,a);
// refresh the list (required only for array widgets)
p_widget.loadList();
}

}

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/1249ee73-b1e2-4f70-acd9-3ec1e7384a19%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

Somjit Banerjee

unread,
Jul 23, 2015, 10:39:55 PM7/23/15
to suppor...@runmyprocess.com
HI Pankaj,

I have modified, the code for triggering the CAPI, but still facing the same issue, the most wired thing is in the developer console all the values and i can see under the response tab, and also there is no error, i am attaching the screen shot of the console please find it out. But still the list field is not being populated.

This the  modified code for triggering the capi

id_list_values_from_collection.trigger({},{},
function list_ok(result){
/* OK*/

var vb_department = new Array();
for(i=0;i<result.length;i++) {
vb_department.push({"label":result[i].department,"value":result[i].department});

}
var a = new RMP_List();
a.fromArray(vb_department);
RMPApplication.setList("vb_department",a);
},


function list_ko(result){

/*ko*/
alert("error while loading the list");
});

So please help.....

You received this message because you are subscribed to a topic in the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this topic, visit https://groups.google.com/a/runmyprocess.com/d/topic/supportforum/3374sVlLZgg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to supportforum...@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
console for department.png

Pankaj Kumar

unread,
Jul 24, 2015, 6:22:18 AM7/24/15
to Somjit Banerjee, suppor...@runmyprocess.com
Hi Somjit,

Kindly check the for loop, from the console image, its seems you are running the loop on object not on array, Please try the below code.

function list_ok(result){
var a = new RMP_List();
a.fromArray(result.vb_department); 
RMPApplication.setList("list_variable_name",a);
}

Note:- Here "list_variable_name" is the "List Variable Name" of the List widget.

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

Somjit Banerjee

unread,
Jul 27, 2015, 12:06:24 AM7/27/15
to Pankaj Kumar, suppor...@runmyprocess.com
Hi Pankaj,

Thanks for the responces, found out where the problem was, it's working fine now.

Regards,
Somjit

Somjit Banerjee

unread,
Jul 27, 2015, 12:10:53 AM7/27/15
to Pankaj Kumar, suppor...@runmyprocess.com
HI Pankaj,

The problem was in the CAPI code itself, even my first piece code for trigeering the capi is working. Thanks for the help.

Regards,
Somjit
Reply all
Reply to author
Forward
0 new messages