cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Node's cardinality

Former Member
0 Kudos

Hi guys,

Is it possible to code and change the cardinality of the node at runtime e.g. NodeA which has the structure below? Does anyone know the code to change it?

Context

- NodeA

Accepted Solutions (1)

Accepted Solutions (1)

sureshmandalapu6
Active Contributor
0 Kudos

Hi zhenmin wang ,

I don't think that we can change the cordinality at runtime. May be if you can find it I will be glad to see the sollution for my things as well.

thanks

Suresh

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

refer this thread ,

i hope it will be helpful.

set the cardinality property

-


Regards,

Ramesh

Former Member
0 Kudos

Hi ... as Said by vishwas you can add a node dynamically by

setting its cardianality property in the foolwing method

public IWDNodeInfo addChild(String name,

Class elementClass,

boolean singleton,

boolean mandatory,

boolean multiple,

boolean mandatorySelection,

boolean multipleSelection,

boolean initializeLeadSelection,

String dataType,

IWDNodeCollectionSupplier supplier,

IWDNodeCollectionDisposer disposer)

In place on boolean mandatory and boolean multiple

you can give true or false value to it.Based on the below description of cardinality you can give boolean values as per you requirement which decides cardinality of your node

The cardinality property

The cardinality property is composed of a pair of values that control the maximum and minimum number of elements may contain at runtime. The cardinality property may have four possible values: u2022 0..1 Zero or one u2022 0..n Zero or more u2022 1..1 One and only one u2022 1..n One or more The first part of the cardinality describes the minimum number of element u2019s element collection may contain. This value is either zero or one, and is stored as a Boolean value(false =0,true=1) . This value can be obtained at runtime by calling the method node.getNodeInfo().isMandatory(). The second part of the cardinality describes the maximum number of elements u2019s element collection may contain. This value is either a 1 or an n (meaning many) and is stored as a Boolean value (false = 1, true = n). This value can be obtained at runtime by calling method node.getNodeInfo().isMultiple().

Regards

Madhavi

vmadhuvarshi_
Contributor
0 Kudos

Zhenmin,

As far as I know, it is not possible to change the node's cardinality at runtime. By the way, What is your reason for changing an existing node's cardinality?

A Node's cardinality consists of a pair of values (0,1 / 1,1 / 0,n / 1,n). First value is represented internally as a Boolean value 'Mandatory' and second value is represented as Boolean value 'Multiple'. You can read these values with

IWDNodeInfo.isMandatory()

and

IWDNodeInfo.isMultiple()

methods but there are no methods to change them at runtime.

You can however, create a node at runtime and define its cardinality too.

use interface [IWDNodeInfo's method addchild|http://help.sap.com/javadocs/NW04s/current/wd/com/sap/tc/webdynpro/progmodel/api/IWDNodeInfo.html#addChild(java.lang.String,%20java.lang.Class,%20boolean,%20boolean,%20boolean,%20boolean,%20boolean,%20boolean,%20java.lang.Object,%20com.sap.tc.webdynpro.progmodel.api.IWDNodeCollectionSupplier,%20com.sap.tc.webdynpro.progmodel.api.IWDNodeCollectionDisposer)] to do so.

public IWDNodeInfo addChild(String name,
                            Class elementClass,
                            boolean singleton,
                            boolean mandatory,
                            boolean multiple,
                            boolean mandatorySelection,
                            boolean multipleSelection,
                            boolean initializeLeadSelection,
                            String dataType,
                            IWDNodeCollectionSupplier supplier,
                            IWDNodeCollectionDisposer disposer)

Hope this helps.

Vishwas.