cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass value attribute to model attribute?

former_member720137
Active Participant
0 Kudos

Hi

How can we convert value attribute to model attribute.

I m using this code..

1. Getting value attribute (ABCD) in a string mat

String mat= wdContext.currentContextElement().getABCD();

2.Then setting the model attribute( MOD) like this

wdContext.nodeAa().nodeBB().currentR_Element().setMOD(mat);

But this code is showing null pointer exception and values r not set.

1 more thing.-> Can v use model attributes in DropDown.. If yes plz tell..

Thanks

Puneet

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Puneet,

you can set a model attribute as you want but you must first instanciate it with:

R_Element() rr = new R_Element();

Regards.

Gianluca Barile

former_member720137
Active Participant
0 Kudos

Thanks Gianluca..

10 points goes to u..

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

have u bound a modal object to model node before using it?

i think - not

so try:

// in wdDoinit

wdContext.nodeAa().bind(new Aa());

// setting parameters

wdContext.currentR_Element().modelObject().setMOD(mat);

// executing model

wdContext.currentR_Element().modelObject().execute();

wdContext.nodeAa().invalidate()

Of course u can use model attributes in DD - like non model.

former_member720137
Active Participant
0 Kudos

Hi Denis

But How will i bind the DD.. coz in case of value attributes.. i simply bind the DD by simple types in Dictionary... Do i have to create Structure for binding Model Attributes to DD..???

Former Member
0 Kudos

hi puneet,

you cannot set the values to model attribute as you have written. you need to create an instance of the structure associated with the model node and set it.

Regards,

Gopi