Skip to Content
author's profile photo Former Member
Former Member

set value in DropDownByKey during runtime

Hello all,

is there a way, to set the valueSet of a DropDownByKey UIElmement during runtime or change the enumeration of a simple type?

I have a RFC function that returns all possible valueSets of the DropDownByKey Element. I create a ContextNode in the Context of the Controller and in the Context of the View and bind them. I also bind the DropDownByKey UIElement (attribute "selectedKey") to a context attribute ("Sysid") of the View Context. Then I create a new method at the controller, that call's the rfc function and invalidate the context after calling the function successfully. I call this method at the doInit Methode of the view as followed...

<u>Coding doInit method of the view:</u>

wdThis.wdGetAccountLockController().callRfcSysteme();

Object attr = wdContext.currentZ_Fh0002_Systeme_OutputElement().getAttributeValue("Sysid");

All the mapping works successfully. I tested this with the second coding line above. So I get the correct value in the attribute "Sysid", but there is no value in the DropDownByKey UIElement. How can I set the value of the context attribute "Sysid" to the attribute "selectedKey" of the DropDownByKey UIElement?

Can anyone help my, please?

Best regards

Petra

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 07, 2005 at 04:33 PM

    Petra,

    Search your NW help for ISimpleTypeModifiable -- you get references to "Dynamic Metadata", "Code Example of Key Binding" and finally "Inserting an Extended Value Selector" -- I guess this provides you with enough information on modifying value set at run-time.

    VS

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Petra,

      Define a simpleType. Bind it to a context attribute.Bind that attribute to the dropdown box. Say the name of attributw value is dropDown.

      get an IwdattributeInfo value.

      create a ISimpleTypeModifiable

      Create a IModifiableValueSet

      then use the modifiable valueset object.put() function to create the dropdown dynamically

  • author's profile photo Former Member
    Former Member
    Posted on Feb 15, 2005 at 10:07 AM

    Hi Petra,

    just giving you a few lines of code as example. I am populating a DropDownByKey UI Element dynamically here.. though the data is hardcoded in my case.. it will come from backend in your case.

    IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute("");

    ISimpleTypeModifiable countryType = attributeInfo.getModifiableSimpleType();

    countryType.setFieldLabel("Country");

    IModifiableSimpleValueSet valueSet = countryType.getSVServices().getModifiableSimpleValueSet();

    valueSet.put("DE","Germany");

    valueSet.put("GB","Great Britain");

    valueSet.put("US","United States");

    ...

    valueSet.put("ALL","All");

    wdContext.currentContextElement().setCountry("All");

    here Country is a Value Attribute in view context having type property maped with a already created simple type.

    You cal also catch the values in the populated set by this code

    for (int idx = 0; idx < valueSet.size(); idx++){

    Object key = v.getKey(idx);

    String text = v.getText(idx);

    }

    hope this helps...

    regards,

    Shubhadip

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.