cancel
Showing results for 
Search instead for 
Did you mean: 

Binding value node elements to model node elements

Former Member
0 Kudos

Hi,

I have a value node in my controller context which also has sub nodes inside it.

There is also a model node in controller context which has all the sub nodes and attributes same as the value node.

The cardinality of both the nodes as well of the sub nodes is same as well as the name of attributes also same.I want to bind the data present in the value node to the model node.

I tried to used the coding :

wdContext.node<model node name>.bind(wdContext.node<valuenode name>.getModelCollection());

But while running the appliation I am getting the error:

Cannot fill a ModelNode automatically. Change the cardinality or use a supply function

Can somebody help me with it.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Model node attributes cannot be directly mapped with value nodes. First we have to create the instance of model object and bind them to context.

Former Member
0 Kudos

Hi,

Refer this thread

you may get some idea!

Regards,

ramesh

yogesh_galphade
Contributor
0 Kudos

Hi

I am not sure about the mapping data with modelnode. But you can use supply function to bind the data

https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_weblog&query=supply+function&adv=false&sortby...

Former Member
0 Kudos

Hi,

Is the cardinality 1..n ?

Regards,

Anagha

Former Member
0 Kudos

Hi Anagha,

Yes the node has the cardinality 1-n and its sub node cardinality is 0-1 for both value and model nodes.

Former Member
0 Kudos

Make Node cardinality 1..1 to guarantee that there is always one and only one element in the node for one parent element.

Child node cardinality can be 0..1 or 0..n as required in your scenario. Please check if this solves the problem.

Former Member
0 Kudos

Hi,

My model node cardinality is 1-n and its child node cardinality is 0-1. Can I change this cardinality directly from the property tab. Wont it affect the model structure. Can I make the singleton property false of the model node.

And I have about 50 Attributes in total in each node and there are two to three sub nodes. Cant I use the bind() method to bind node directly instead of checking the node size and using for loop and binding each single attribute.

Regards,

Ardhendu.

Former Member
0 Kudos

Hi,

Is your intention is to have same data in model node as is in values node ?, then probably you can go for WDCOPYSERVICE(source node, target node) which will copy all the data elements from source node to target node.

Regards

Raghu

Former Member
0 Kudos

Hi,

Yes I want to copy elements from value node to modal node. But my value node and model node both contains sub nodes inside it. Using WDCopYService I can only copy the parent node attributes but the child node do not get copy. Can you help me with this out.

Regards,

Ardhendu.

Former Member
0 Kudos

Hi Ardhendu,

If the child nodes are singleton nodes why don't you use WDCopyService for those nodes seperatley.

First use WDCopyService for Parent node and after that use it for child nodes. I guess, there won't be any problem if the child nodes are singleton nodes.

Regards,

VJR.

Former Member
0 Kudos

Hi,

I have tried using the WDCopyservice but then also I am not able to run the application.

The error is model node cannot be bind automatically. Change cardinality oruse supply function.

But I have made the singleton property of all the nodes to false. And the cardinality is 1-1.

Former Member
0 Kudos

Hi Ardhendu Sarkar ,

Dont change any cardinality of model node.

Just create the Value node same as like Model node. [value attributes names should be same as model attributes names, same cardinality, same singleton property].

Don't map anything between model node and value node.

In the init() or any action, use WDCopyService to copy from the parent node from Model to Value node. After that, use WDCopyService to copy the child nodes.

Map the value nodes, to the required UI element.

Regards,

VJR.