cancel
Showing results for 
Search instead for 
Did you mean: 

Populating child node

Former Member
0 Kudos

Hi All,

I am new to Webdynpro. I have an table in my view and in one column i have to have one drop down list. i added it in UI.

in context i created an node for table and added the attributes and a child node for drop down. in child node i have one attribute.

Problem is , when i create an element for table, i am not able to create child node element and i dont know how to do this.

so i am not able to populate drop down list.

i gave singleton as false for child node.

please let me know how can i populate the child node

Many Thanks in advance,

Senthil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hai

try this code,table parteners is a table node and its contains another node subnode.

public void wdDoInit()

{

//@@begin wdDoInit()

//MATERIAL INPUT FIELD in TABLE RFC(GETTING DATA FROM DB)

try

{

//table declaration

IPrivateSalesdet.ITableElement element;

IPrivateSalesdet.ITableNode node=null;

pnode=wdContext.nodeTablepartners();

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

{

try

{

pe1=pnode.createTablepartnersElement();

pnode.addElement(pe1);

wdContext.nodeTablepartners().moveTo(j);

IPrivateSalesdet.ITablepartnerssubnodeElement element2;

IPrivateSalesdet.ITablepartnerssubnodeNode node2=null;

IPrivateSalesdet.ITablepartnerssubnodeElement pe2;

IPrivateSalesdet.ITablepartnerssubnodeNode pnode1=wdContext.nodeTablepartners().nodeTablepartnerssubnode();

pe2=pnode1.createTablepartnerssubnodeElement();

pnode1.addElement(pe2);

}

wdContext.nodeTablepartners().moveFirst();

// partnerstablesubnode declaration

}catch()

{

}

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

Hi Sharanya,

it was very helpful but i am getting as many number of times each value in drop box as number of rows.

for few rows no value at all for drop down box.

i want to have only "passed", "failed" in each drop box of every row.

this is the code i am using now,

IStatusTableNode nd = wdContext.nodeStatusTable();

For -loop

IStatusTableElement ele = (IStatusTableElement)nd.createStatusTableElement();

ele.setAttributeValue("Scenario", scenarioname);

ele.setAttributeValue("ScenarioId", scenvarid.substring(0,scenvarid.indexOf("_") ));

ele.setAttributeValue("ScenarioVariant", scenvarid);

ele.setAttributeValue("BPVT", bpvts<i>);

nd.addElement(ele);

wdContext.nodeStatusTable().moveTo(i);

IBPVTStatusNode BPVT = wdContext.nodeStatusTable().nodeBPVTStatus();

IBPVTStatusElement el = BPVT.createBPVTStatusElement();

el.setStatus("Passed");

BPVT.addElement(el);

el = BPVT.createBPVTStatusElement();

el.setStatus("Failed");

BPVT.addElement(el);

wdContext.nodeStatusTable().moveFirst();

end of for loop

what i am doing wrong?

Thanks,

Senthil

Former Member
0 Kudos

It's much easier.

To add elements to the drop-down list in table row #i, do something like


IStatusTableElement row = wdContext.nodeStatusTableElement().getStatusTableElementAt(i);
String[] values = { "Passed", "Failed" };
for (int i = 0; i < values.length; ++i)
{
  IBPVTStatusElement status = row.nodeBPVTStatus().createBPVTStatusElement();
  row.nodeBPVTStatus().addElement(status);
  status.setStatus(values<i>);
}

Armin

Former Member
0 Kudos

Hi Armin ,

ya it is working fine. Thanks lotttt

Regards,

Senthil

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Set the cardinality of your child node as 1..1

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj,

i have to add more than one element right for child node attribute.

i want to add "passed", "failed" to child node attribute Status. in that case can i use cardinality 1..1?

Regards,

Senthil

Former Member
0 Kudos

hai,

give the same coding that you have given to create the node elements(root). for your child nodes also.

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

Hi Sharanya,

THis is the code,

IStatusTableNode nd = (IStatusTableNode)wdContext.getChildNode("StatusTable",0);

IStatusTableElement ele = (IStatusTableElement)nd.createStatusTableElement();

ele.setAttributeValue("Scenario", scenarioname);

ele.setAttributeValue("ScenarioId", scenvarid.substring(0,scenvarid.indexOf("_") ));

ele.setAttributeValue("ScenarioVariant", scenvarid);

IBPVTStatusNode BPVT = (IBPVTStatusNode)nd.getChildNode("BPVTStatus", 0);

IBPVTStatusElement el = BPVT.createBPVTStatusElement();

el.setStatus("Passed");

BPVT.addElement(el);

nd.addElement(ele);

BPVTStatus is the child node.status table is the root node.

Thanks,

Senthil