cancel
Showing results for 
Search instead for 
Did you mean: 

understanding bind()

Former Member
0 Kudos

Hello!

I don't understand the necessity of -> bind() as below

stated. Why is it needed. In which cases must it

be used and when can it be ignored?

Maybe always if you create a Nodeelement ?????

Regards

sas

IPrivateTestViewInteractivePDFForm.IAddressNodeElement element = wdContext.nodeAddressNode().createAddressNodeElement();

element.setFirstName("Will");

element.setName("Smith");

wdContext.nodeAddressNode().bind(element);

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Based on the code what you have posted

IPrivateTestViewInteractivePDFForm.IAddressNodeElement element = wdContext.nodeAddressNode().createAddressNodeElement();

element.setFirstName("Will");

element.setName("Smith");

wdContext.nodeAddressNode().bind(element);

In the above code first you are trying to create an element of the node "AddressNode", Which will be stored in a variable called "element."

But this element and the node "AddressNode" doesnt have any relation other than the structure.

Now if you want to make this element part of this node you need to add that to node "AddressNode" . To do this their are two ways

Either you can use the one currently used , or else while creating it self you can make use of the method createAndAddElement() for the node.

One thing you have to note here is when you bind your previous values will be overridden. So if you want to add multiple elements add them to an List and then bind the list.

Hope its clear to you.

Regards

Ayyapparaj.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Ok ,

but one question more.

Generally create command which you do using is, if you want to create an instace, don't you ?

You say:

To create a node you have to use the following code:

wdContext.getNodeInfo().addChild(name, elementClass, singleton, collection, selection, initializeLeadSelection, structure)

When is it necessary to create a node? I have thoughed you can insert simply nodes and elements

by right clicking inside of each controller context tab.

regards

ilhan

Former Member
0 Kudos

Hi,

When is it necessary to create a node?

When you are not sure abt the actual structure at design time, you can create it. This is the time where we use this.(In one word Dynamic)

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj and Others,

but (pls see NWDS Help Example of the Use of an Interactive PDF Form

go to Control Interactive Form, right click and hit at the bottom the link

Example of how to use an Interactive PDF Form.)

In the Context structure is Node -> AddressNode already being existing why

recreate it again with this command ->

wdContext.nodeAddressNode().createAddressNodeElement().

What does this command exactly do -> wdContext.nodeAddressNode().createAddressNodeElement().

Creating a new "AddressNode" ?

Creating a new "AddressNode-Element" ? If so There are also two elements existing

named "FirstName" and "Name"

Regards

Sas

Former Member
0 Kudos

Hi,

In the Context structure is Node -> AddressNode already being existing why

recreate it again with this command ->

wdContext.nodeAddressNode().createAddressNodeElement().

In the above statement you are creating an instance(element ) under that context node, and not the node.

What does this command exactly do -> wdContext.nodeAddressNode().createAddressNodeElement().

This adds an element to an existing node called Address

Creating a new "AddressNode" ?

To create a node you have to use the following code

wdContext.getNodeInfo().addChild(name, elementClass, singleton, collection, selection, initializeLeadSelection, structure)

Creating a new "AddressNode-Element" ? If so There are also two elements existing

named "FirstName" and "Name"

firstname and Name are not elements they are attributes.

Regards

Ayyapparaj

Former Member
0 Kudos
chintan_virani
Active Contributor
0 Kudos

Erdem,

Check last piece of this weblog : /people/niharika.jeena/blog/2005/03/31/differnce-between-add-and-bind-method-for-passing-elements-to-a-bapi-from-webdynpro

Chintan