cancel
Showing results for 
Search instead for 
Did you mean: 

howto, string from simple type enumeration

Former Member
0 Kudos

Hi, I have several RadioButtons and DropDownBoxesByKey which are filled with options by Simple Type enumerations. So I made an Simple Type, added enumerations, that simple type is binded to RB or DDB context and such context into the layout item itself. Usual way.

In case of normal InputField, either of type of String or Date I have:


String ctx1 = wdContext.currentContextElement().getCtx1();
Date ctx2 = wdContext.currentContextElement().getCtx2();

that works fine and I can do with it whatever I want. In case of an context to which I have binded SimpleType I dont know what type should I use, how can I "pick" chosen value (either from DDB or RB)? Please advice. Balmer

Accepted Solutions (1)

Accepted Solutions (1)

former_member201361
Active Contributor
0 Kudos

Hi,

just type

wdContext.currentEuropeElement().

then Pres ctrl+space

here you can see all the methods and check whether getCountries method is present .

if it is there means , look what is the return type.

organize imports >rightclick>Source-->organize imports.

Edited by: fazal ahamed on Mar 25, 2008 5:58 PM

Edited by: fazal ahamed on Mar 25, 2008 6:00 PM

Former Member
0 Kudos

Hi, no getCountries method availible but there is get AttribiteValue(string arg[]) however Im no able to use it. Thanks for answers, please adivice. It is very urgent. Balmer

Former Member
0 Kudos

Hi Balmer,

One case if u miss brackets afte method, tht will show the error u mentioned. -->getcountries();

and another chance might be with u r cardinality property. pls let me knw u r cardinality value?

*GS

Former Member
0 Kudos

Hi, funny thing is that


String ctx1 = wdContext.currentContextElement().getCtx1().toString();

works in both cases, DDB and RB. It didnt show me that option after ctrlspace normally, it did when I used in between already written wdContext.currentContextElement()."ctrlspace".toString(); Even that, it showed error, I saved metadata anyway and bam, no errors. Works fine.

So that issue is resolved, got familiar issue with "set" now

How to reverse from String to previous type? I use


stUpdate.execute("select tablename Ctx1");

wdContext.currentContextElement().setCtx1(resultSet.getString(1));

and it works fine. I went through ctrl+space option but no resolution was found. Please advice. Balmer.

Former Member
0 Kudos

hi Balmer,

I understand your requirement is to find the selected value fromt he DDK or RDK to which the simple type is added. Now the simple type has enumeration attached to it. Say, you dropdownkey is mapped to attribute "Key" in node "DropKey". Now say your enumeration has 2 values 1-product1 and 2-product3.

Now to get the values,

you have to:

String value = wdContext.currentDropKeyElement().getKey();

if(value.equals("1"))

{

// Action for Selection of Product 1

}

else if(value.equals("2"))

{

//Action for Selection of Product 1

}

it can easily work this way.

Now if you select Product1 from the dropdownkey, a particular action occurs, and if select Product2 another...

regards,

pinki

Former Member
0 Kudos

Hi pinki, I get "type mismatch: cannot convert from Key to String. Please advice. balmer

former_member197348
Active Contributor
0 Kudos

Hi Balmer,

If you are not able to work out with .toString() method,

Can you try with explicit type casting?

i.e.,

Sting value = (String) // your object ( I guess), resultSet.getString(1); 

regards,

Siva

Answers (1)

Answers (1)

former_member197348
Active Contributor
0 Kudos

Hi Balmer,

You can find the type of the simpleType here:

Open Simple Type

Open definition Tab (default tab)

See built-in Type

You have to use the same type

If it is a String you can get read the selected key like this:

String key = wdContext.currentContextElement().getRBKey();

regards,

Siva

Former Member
0 Kudos

I forgot to mension it, build in typ is String, yet if I do


String coutries = wdContext.currentEuropeElement().getCoutries;

I get "getCountries cannot be resolved or is not a field"

So the issue is still up, please advice, it is very urgent. Thank for answer, Balmer.