cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the intial value in dropdownbyindex?

Former Member
0 Kudos

Hi All,

I have a small problem for initializing the dropdownbyindex value.

I have created Dropdownbyindex and map the texts value from context value attribute here Context attribute is in inside the three nodes. how can I capture the inside value attribute and how to intialize the value.

My Context nodes are --MainNode

--childnodeOne

--childNode2

--valueAttribute.

The above way my context node strucure and I have mapped this value attribute to dropdownbyindex for this how to initilze the value.

Advance thanks.

Kris.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Assumung you have context structure as follows:

MainNode(Cardinality 1..1, Sigleton)

|_ChildNode1(Cardinality 1..1,Non Sigleton)

|_ChildNode2(Cardinality 0..n,Non Sigleton)

|_ValueAttribute

As you said that you have mapped the value attribute which is inside three nodes.

You can create the values as follows:

e.g.

for(int i =0;i < 5; i++)

{

IChildNode2Element cn2 = wdContext.createChildNode2Element();

cn2.setValueAttribute("VA"+i);

wdContext.currentMainNodeElement().nodeChildNode1().currentChildNode1Element().nodeChildNode2().addElement(cn2);

}

This will create 5 values in the drpdown.

Now to initialize the value you can set the leadselection for the node ChildNode2:

e.g

wdContext.nodeChildNode2().setLeadSelection(3);

This will display the 4th value in the drpdown ibitially.

To get the value currently selected in dropdown you can write something like this:

wdContext.currentMainNodeElement().nodeChildNode1().currentChildNode1Element().nodeChildNode2().currentChildNode2Element().getValueAttribute());

Regards,

Ajay

Answers (3)

Answers (3)

Former Member
0 Kudos

closing the thread

Former Member
0 Kudos

Hi,

do the following steps

IPrivate<viewName>.IMainNodeNode node=wdContext.nodeMainNode();

IPrivate<viewName>.IMainNodeElement elem=wdContext.createMainNodeElement();

elem.setValueAttribute("<value>");

node.addElement(elem);

and in the property window of the MainNode set the Selection cardinality to 1..1

regards

karthik

Former Member
0 Kudos

HI,

Have a look at the threads

https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/91c5e990-0201-0010-4981-9b2075751da5

http://help.sap.com/saphelp_nw2004s/helpdata/en/dd/b0884118aa1709e10000000a155106/frameset.htm

Find the node which the attribute you bind is child and

IPrivate<View>.I<Node>node n=wdContext.Node<Node>

IPrivate<view>.I<Node>Element e=wdContext.create<Node>Element

e.set<Attribute>("value");

n.addElement(e);

Regards

Saravanan K