cancel
Showing results for 
Search instead for 
Did you mean: 

Binding an Attribute

Former Member
0 Kudos

Hi all

How do you bind an Attribute to a simple type dynamically?

Regards,

Surya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

chk it

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Surya,

Your question not so clear, however,

if you wanna get simple type for an attribute and set some value set for the same, this will do:

ISimpleTypeModifiable simpleType = wdThis.wdGetContext().getNodeInfo().getChild("TestNode").getAttribute("TestAttr").getModifiableSimpleType();

simpleType.getSVServices().getModifiableSimpleValueSet().put("key", "value");

Regards,

TFG - Aparna .P

Former Member
0 Kudos

Hi Surya,

I don't know if this is what you want...

To create a atributte in the root node you can use:

wdContext.getNodeInfo().addAttribute("MyAtt", "com.sap.dictionary.string");

To create atributte in the root node from another node (mapped):

wdContext.getNodeInfo().addMappedAttribute("MyNewAttributte","AtributeMapped");

I've never modified the mapping of a node or attributte dynamically... i think that can't be done.

Hope this can be helpful

Eneko

Former Member
0 Kudos

hi,

Binding ordinary attribute,

IWDNodeInfo NodeInfo = wdContext.getNodeInfo().addMappedChild("NewNode",null,true,true,false,null,false,true);

IWDNodeInfo nodeInfo = wdThis.XXController().wdGetContext().getNodeInfo().getChild("DynamicNode");

NodeInfo.setMapping(nodeInfo ,true);

Simple type attribute :

You can use this code to fill enumeration at runtime.

But this is for Composite Applicaitons, add the required jars and try

TypedFieldDescriptorFactory factory = new TypedFieldDescriptorFactory();

TypedFieldDescriptor descriptor = factory.getTypedFieldDescriptor("", "String", "com.sap.Cities", null, Locale.GERMAN);

ISimpleType type = descriptor.getSimpleType();

ISimpleTypeModifiable modifiable = wdThis.wdGetAPI().getContext().getModifiableTypeOf("Cities.Cities");

modifiable.setSVServices(type.getSVServices());

Check the below thread also,