on 07-27-2006 7:38 AM
Hi
I am want to add the values in DropDownByKey dynamicaly which are returned by a WebService so how can we do that please give me the steps or code if possible
Thanks
Ninad
Hi,
You can create a key on your own. You don't strictly need it from the webservice.
Quoting previously submitted code:
valueElement.setId("Key_" + loopIndex);//or whatever you might want to put.
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can populate dropdown values from webservice using the following steps. I assume you have idea about custom controller and better you have to use DropdownbyIndex intead of DropdowmByKey.
step1:
Create custom controller.Inside custom controller Bind input value then execute webservice.
step2:
Now you have value node which is returned from web service. After execute web service you can find size using the following code. create value(Role_Output) node and modelnode(Role_result) object using the code.
Step3:
<custom controller name>.IRole_ResultNode modelnode=wdContext.nodeRole_Result();
<custom controller name>.IRole_OutputNode valuenode=wdContext.nodeRole_Output();
valuenode.invalidate();
int size=modelnode.size();
Step4:
After find size using loop fetch values from model node into value node.Asume in this value node contains key and value.
for(int j=0;j<modelnode.size();j++){
<custom controller name>.IRole_ResultElement modelElement=modelnode.getRole_ResultElementAt(j);
<custom controller name>.IRole_OutputElement valueElement=wdContext.createRole_OutputElement();
valueElement.setId(modelElement.getKey());
valueElement.setText(modelElement.getValue());
valuenode.addElement(valueElement);
}
step5:
After that bind this value node(Role_Output) into Component controller. Then Bind value node(Role_Output) from component controller into view.
Step6:
Finally bind dropdown UI Element into Role_Output node's attribute(ID).
Kind Regards,
S.Saravanan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ninad,
I put sample as returned key and value from webservice. You need to display user name only means just create one attribute(username) under Value node instead of key and value. Use the following code:
Step4:
After find size using loop fetch values from model node into value node.Asume in this value node contains key and value.
for(int j=0;j<modelnode.size();j++){
<custom controller name>.IRole_ResultElement modelElement=modelnode.getRole_ResultElementAt(j);
<custom controller name>.IRole_OutputElement valueElement=wdContext.createRole_OutputElement();
valueElement.setusername(modelElement.getuername());
valuenode.addElement(valueElement);
}
<b>Valuable answer=point</b>
Kind Regards,
S.Saravanan.
Hi Saravanan
i got confused I have created the web service and executed it in default component controller and its returning 3 internal tables called sender recever and doctype and each table has only one field which i want to add in 3 combos so can you please explain me how to write the code
Thanks
Ninad
Hi,
Put the following code inside component controller. Before you should check size of three internal tables(sender,receiver and doctype).What is the output of webservice?.
for(int j=0;j<modelnode.size();j++){
IPrivate<componentcontrollername>.IRole_ResultElement modelElement=modelnode.getRole_ResultElementAt(j);
IPrivate<componentcontrollername>.IRole_OutputElement valueElement=wdContext.createRole_OutputElement();
valueElement.setusername(modelElement.getuername());
valuenode.addElement(valueElement);
}
Kind Regards,
S.Saravanan.
Hi Saravanan
I am extrimly sorry but i am not getting anything from bellow lines
IPrivate<componentcontrollername>.IRole_OutputElement valueElement=wdContext.createRole_OutputElement();
valueElement.setusername(modelElement.getuername());
valuenode.addElement(valueElement);
I will paste my for-loop please tell me what i have to write next for those 3 lines there
for(int i=0;i < wdContext.nodeSender().size();i++)
{
IPrivateDTCEventSearchView.ISenderElement senderElement = wdContext.nodeSender().getSenderElementAt(i);
}
i am testing for sender internal table which is sent over webservice and its returning one record
but while i print the value for sender size which i checked in for-loop condition its returning me zero so please tell me where is the problem
Thanks
Ninad
Hi,
Please put the follwoing code. Suppose you bind node(ISender_Output) to dropdown with one attribute(username). You should create ISender_Output in Component controller and bind into view finally bind into dropdown.
IPrivateDTCEventSearchView.IRole_OutputNode valuenode=wdContext.nodeRole_Output();
for(int i=0;i < wdContext.nodeSender().size();i++)
{
IPrivateDTCEventSearchView.ISenderElement senderElement = wdContext.nodeSender().getSenderElementAt(i);
IPrivateDTCEventSearchView.ISender_OutputElement valueElement=wdContext.createRole_OutputElement();
valueElement.setusername(senderElement.getuername());
valuenode.addElement(valueElement);
}
Like you can add remaining dropdown.
Kind Regards,
S.Saravanan.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.