cancel
Showing results for 
Search instead for 
Did you mean: 

simple type enumeration type...

Former Member
0 Kudos

Hi, I made a RadioButton, binded to it "answerContext" and binded to it an Simple Type enumeration with two options, "Yes" and "No". Now I want to:


String answerContext = wdContext.currentElement().getAnswerContext();

but it provides "Type mismatch, cant convert from answerContext to String". So what type is it? (I checked int, boolean, no match as well).

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

Balmer,

Check if you mapped your simpletype to answerContext attribute correctly.

Also the code should be

String answerContext = wdContext.currentContextElement().getAnswerContext();

Try using RadioButtonGroupByIndex..

Chintan

Former Member
0 Kudos

yeah, code was like you wrote it, I must have done wrong paste somehow. What do you mean by "Check if you mapped your simpletype to answerContext attribute correctly."? I cant switch to RadioButtonsGroupedByKey, to late for that. Thanks for your help. Regards, Balmer

chintan_virani
Active Contributor
0 Kudos

Check the type property of your answerContext attribute. Is the mapping done to the SimpleType u have created...

Former Member
0 Kudos

of course

chintan_virani
Active Contributor
0 Kudos

Balmer,

What is the signature when the options are presented to you in IDE.

I mean after you write wdContext.currentContextElement.get and press Ctrl Space does it say something like

getAnswerContext String IPrivate<ViewName>.IContextElement

If it displays String then it should work.

Chintan

Former Member
0 Kudos

when I press ctrl+space at "wdContext.currentContextElement.get" I get AnswerContext as it should be and some of others, still type mismatch ;c

former_member751941
Active Contributor
0 Kudos

Hi Balmer,

During dictionary type creation if you check the Generate a class representation of enumeration then your code will be like this

<b>String answerContext = wdContext.currentContextElement().getAnswerContext().toString();</b>

wdComponentAPI.getMessageManager().reportSuccess("answerContext : "+ answerContext);

because wdContext.currentContextElement().getAnswerContext() will return a object of dictionary type.

Otherwise

String answerContext = wdContext.currentContextElement().getAnswerContext();

is fine.

answerContext is the value attribute under Context of dictionary type .

Regards,

Mithu

Former Member
0 Kudos

hi....

What is answerContext??.....an attribute of a node???.If so please check, what what it is. It shoulde be made String. If it is pointing to some simple Datatype, that datatype should be of String type. Please check this in your project

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I have tried the above mentioned prob and its working for me;

What i did:

Created a simple type name criteria Built-in type as string

value Description

A First

B Second

C Third

D Fourth

Add a UI Element RadioButtonGroupByKey

Bind it and in init method get the value in a string using your code

Check the entire; you must went wrong some where.

Regards

- Vinod

*

former_member201361
Active Contributor
0 Kudos

hi,

please check the context attribute you have created whether it is string or of some other type.

Former Member
0 Kudos

context attribute has type of "com.sap.test.CtxSimpleType", and in simple type it has Build-In type of String but that does not change a thing since string is not an answer. Regards, Balmer