on 2007 Jul 11 3:08 PM
hi experts,
i am developing webdynpro application with DCs, in my application i have Dropdown list, i want to get values from Backend DB, i am using oracle 10.2
here my Question r.
1. For using Dropdown list which Dropdown list i should use, i mean DD BY KEY or DD BY INDEX.
2. where extractly i should connect the datasource, where i should mapping to all attributes in the datasource to context nodes or attributes.
can i get anycoding how to fill values in dropdown and how to retrive the selected value.
thk u ,
pls help me on this issues.
-
vijai
Hi,
Better u use DD by Index,
1)create 1 attribute, bind that to dropdownbyindex element.
int size=wdContext.nodebapiNode().size();
List list1=new ArrayList();
for(int i = 0; i<size; i++)
{
IPrivateView.Idropdownnodeelement ele =wdcontext.nodedropdownvalue.createdropdownvalueelement();
ele.setattribute(wdcontext.nodebapivalue.getelementAt(i).getAttributeasText("element name"));
list1.add(ele);
}
wdContext.nodedropdownvalue.bind(list1);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1. How to choose your DD ?
The diference between Key and Index is with the index you have to map you DD to a context, and the index correspond to the lead selection of the node. Wherase the DD b y Key is mapped just to one attribute which you use like the following code :
//Get access to data type instance to be modified at runtime
//my attribute is MonthName
ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("MonthName");
//Set valid values for this data type
IModifiableSimpleValueSet values=myType.getSVServices().getModifiableSimpleValueSet();
values.put("0","January");
values.put("1","February");
values.put("2","March");
values.put("3","April");
values.put("4","May");
wdContext.currentContextElement().setMonthName("10");
2. For your second request I don't get you. Could you be more precise ?
Regards
Message was edited by:
berthe joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In your component controller create a value node say "DDNode" with attributes "DDValues" of type
string.
Map this context from Component controller to view context.
In wdDoInit() of component controller
1.Create a Database connection as explained in the blog.
2.Execute the query and get the results.
From your result set populate the values in the value node by looping through the result set.
for(int i=0;<result set size>;i++)
{
IPrivate<your view>wView.IWdDDNodeElement ele = wdContext.nodeDDNode.createDDNodeElement(); // create element in the node
// set the value in the attribute
ele.setDDValues(<Value from your resultset>);
// add the element to the node
wdContext.nodeDDNode.addElement(ele);
}
In your view map the DDValues attribute to the texts property of the DropDownByIndex.
The values will be populated automatically.
User | Count |
---|---|
70 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.