cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown by index

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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);

Answers (1)

Answers (1)

Joseph_BERTHE
Active Contributor
0 Kudos

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

Former Member
0 Kudos

hi suresh,berthe

thank you for reply,

suresh -


> where i need to write the code in which method (ex:wdinit()), can i get in detail coding.

berthe-------> i mean where to map the datasource (binding to DB)

thk u,

help me on this.

-


vijai

Former Member
0 Kudos

Hi

/people/anilkumar.vippagunta2/blog/2007/02/20/reading-and-writing-images-from-sqlserver-in-webdynpro

Regards

Ayyapparaj

Former Member
0 Kudos

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.