cancel
Showing results for 
Search instead for 
Did you mean: 

NullPointer Exception at ChildNode of Context

Former Member
0 Kudos

Hi All,

I have to show in the table in the rows like first column as dropdowm next columns as input fields.

Dropdown values come from RFc output element and 2 input fields user input fields.

So i create one node contains one child node and two value attributes. inner child node contains again two attributes,

I've craete table binded with main node and dropdown binded innner node elememt and two input field binded with child elements of main node.

Main Node is : Name : Update cardinality is 0-n selection 0-1 singleton: true

Child Node of Main Node --- Name : AccessorialType_Node cardinality is 0-n selection 1-1 singleton: false;

Child node elements -- Name : AT type String

Child node elements -- Name : ATV type String

Main node element - Amount Type String

Main node element - Comments Type String

Even i am getting RFC outputtable size also i have to fill those values in the drop down.

I am getting NullPointer Exception at this line: objAccessorialType = wdContext.createAccessorialType_NodeElement();

I used following code.

IAccessorialType_NodeElement objAccessorialType = null;

try

{

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("onActionUpdate called"+wdContext.nodeI_Acctype().size());

objAccessorialType = wdContext.createAccessorialType_NodeElement();

objAccessorialType.setAT("Select AccessorialType");

objAccessorialType.setATValue("");

wdContext.nodeAccessorialType_Node().addElement(objAccessorialType);

int sizeAccType = wdContext.nodeI_Acctype().size();

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("onActionUpdate called"+sizeAccType);

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

{

objAccessorialType = wdContext.createAccessorialType_NodeElement();

objAccessorialType.setAT(wdContext.nodeI_Acctype().getI_AcctypeElementAt(i).getZacctype());

objAccessorialType.setATValue(wdContext.nodeI_Acctype().getI_AcctypeElementAt(i).getZacctype());

wdContext.nodeAccessorialType_Node().addElement(objAccessorialType);

}

}

catch(Exception e)

{

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Catch block in IMServiceEntryList :: onActionUpdate( ) Error==> Message-"e.getMessage()"StackTrace--->""StackTrace"e.getStackTrace().toString()"Error"e);

}

Thanks & Regards

Adams

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Adam,

As others pointed out, the problem is that your "main node" is either empty or has no lead selected element, i.e. call to wdContext.currentNameElement() return null.

Make sure your main node is populated before call to create child node and either wdContext.nodeName().setLeadSelection(idx) is invoked or user selected current element via UI.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Thanks All,

Rathna and Silalev solution worked.

Former Member
0 Kudos

Hi Adam,

The following program will create 5 rows for ur table

IPrivate<View>.IUpdateNode rootNode=wdContext.nodeUpdate();

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

{

IPrivate<View>.IUpdateElement rootEl=rootNode.createElement();

rootNode.addElement(rootEl);

rootEl.setAmount("AMOUNT "+i);

rootEl.setComments("Comments "+i);

<b>IPrivate<View>.IAccessorialType_Node subNode=rootEl.nodeAccessorialType_Node();</b>

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

{

IPrivate<View>.IAccessorialType_Element subEl=subNode.createAccessorialType_NodeElement();

subNode.addElement(subEl);

subEl.setAT("DropdwonValue_AT"+j);

subEl.setATV("DropdwonValue_ATV"+j);

}

}

Former Member
0 Kudos

Hi

First create a element for Parent node and add that element to the node.

IUpdateElement parentelement = wdContext.createUpdateElement();

wdContext.nodeUpdate.addElement(parentelement);

Then in the for loop create the element for the child node, set the values to the attribute and add the element as below.

wdContext.nodeUpdate().nodeAccessorialType_Node(i).addElement(objAccessorialType);

Regards,

Rathna.

Former Member
0 Kudos

hi,

write a supply function and fill the drop down in the supply function.

Regards,

Gopi