Programmatically lookup for a value in a custom list

465 views
Skip to first unread message

Luigi

unread,
May 9, 2017, 6:50:31 AM5/9/17
to Fujitsu RunMyProcess Developer Community
Hello,
in a Web Interface, I need to lookup a custom list to get the corresponding value providing the label.
The value should then appear as value of a text widget.

Is it possible to have a script example ?

Is it necessary to define a custom list widget in the WI or the script can lookup directly the custom list existing in the project ?

Thank you,
Luigi

Ghanshyam Mule

unread,
May 9, 2017, 9:11:20 AM5/9/17
to suppor...@runmyprocess.com, Luigi Cichella
Hi Luigi,

The answers to your questions:-

1.Is it possible to have a script example ?
 Ans:- yes.

Assume that you have list widget attached with custom list. You need to take one js widget write code given below. & in the listen to variable of js widget  
pass the value variable of list.

var selected_value=id_codes_avaliable.getSelectedValue("codes_avaliable");   // To retrieve value of selected item from list widget.
RMPApplication.set("code_selected",selected_value);                                  //To set value to value variable of textfield using set() function. 

2. Is it necessary to define a custom list widget in the WI or the script can lookup directly the custom list existing in the project ?

Ans:-Yes. You need to define a custom list widget in WI.
        No. The script can lookup directly the custom list in existing project.(Custom list need to be attached to List widget on Web interface).

Please confirm that this will satisfies your requirement.If not elaborate your issue in more detail.

Regards,
Ghanshyam mule
Fujitsu RunMyProcess Support



Luigi

unread,
May 9, 2017, 11:03:34 AM5/9/17
to Fujitsu RunMyProcess Developer Community, ciche...@fatergroup.com
Thank you, Ghanshyam.

Is there also a function to lookup the custom list passing (as a parameter) the "label" to be searched and have the corresponding value of the list returned ?

Luigi

Abhilash Sambhare

unread,
May 10, 2017, 6:47:03 AM5/10/17
to Fujitsu RunMyProcess Developer Community, ciche...@fatergroup.com
Hi Luigi,

Please try with the following code:

var a=id_codes_avaliable.getList();      //Get the complete list into one variable ,id_codes_avaliable-->identifier of the list


var l=RMPApplication.get("label_codes_avaliable");   //retrieve the label from list,label_codes_avaliable -->label variable of the list


var b=a.getItemFromLabel(l);   //pass the label as parameter to retrieve the value


alert(JSON.stringify(b.value));    //b.value will give value acccording to the label


RMPApplication.set("code_selected",b.value);    //Set the value into the text widget,code_selected-->variable of text widget


For more information regarding the list function,please refer the below link:


Hope this helps you.Please let us know if you have any further query

Thanks & Regards,
Abhilash
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+unsubscribe@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://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/ce5a2b77-9277-4428-bdda-3d90f346c8da%40runmyprocess.com.

ciche...@fatergroup.com

unread,
May 10, 2017, 10:13:33 AM5/10/17
to Fujitsu RunMyProcess Developer Community, ciche...@fatergroup.com
> To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
It works!

Thank you,
Luigi
Reply all
Reply to author
Forward
0 new messages