cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Web Dynpro Project

Former Member
0 Kudos

Hello, im creating a Dynamic application that executes a RFC, in the output parameter i have 2 tables; A and B,the thing is that i need to loop the A table and compare with the different elements of the B. e.g.:


 for(int i =0; i<a.size(); i++){
   for(int j =0; j < b.size(); j++){
      if(a.getName().equals(b.getName())){
         /*they are equal*/
      }
   }
 }

 

this is easy, the problem comes when i have to create dynamiclly Combo Boxes (CB), for every element in the A table y have to create a CB, and the elements that match in the second loop and are in the B table are the value helps that i have to assign to the ComboBox

how do i do this, i already have this code created:


   wdThis.wdGetZ_EPA_UNIFORM_GETDETAILController().executeZ_Epa_Uniform_Getdetail_Input();

        IWDTransparentContainer tfc =
        (IWDTransparentContainer) view.getElement(
        "TransparentFieldContainer");
        
        /*loop To A = It_Zepa_Unif_GDElement table*/
        if (wdContext.currentIt_Zepa_Unif_GDElement()
	    .node()
	    .size()> 0) {
           
            do {

                String Id = wdContext
                .currentIt_Zepa_Unif_GDElement()
		.getSbjkt();
                
                /*Create the Label*/

                IWDLabel theLabel =(IWDLabel)
                             view.createElement(
                             IWDLabel.class,"lbl" + Id);
               
               /*Create the DropDownListBox (Combo Box)*/

               IWDDropDownByKey theList =
                      (IWDDropDownByKey)view
                      .createElement( 
                      IWDDropDownByKey.class,"ddk" + Id);

               /*Assign the text for the label*/

               theLabel.setText(wdContext
                         .currentIt_Zepa_Unif_GDElement()
                         .getStexs());

               theLabel.setLabelFor(theList.getId());

               /*Create my Value Help*/
                IWDAttributeInfo info;
                ISimpleTypeModifiable st =
                   info.getModifiableSimpleType();

                IModifiableSimpleValueSet vs = st
                     .getSVServices()
                     .getModifiableSimpleValueSet();

                if (wdContext
		    .currentIt_Ze9016_GDElement()
		    .node()
		    .size()> 0) {
         
          /*loop at the B = It_Ze9016_GDElement() table*/
                  do {
                        if (wdContext
			    .currentIt_Ze9016_GDElement()
			    .getSbjkt()
			    .toString()
			    .equals(Id)) {

                              vs.put(wdContext
			       .currentIt_Ze9016_GDElement
                              ().getValue(),wdContext
			       .currentIt_Ze9016_GDElement
                              ().getWtfld());	
			}
                   } while ( wdContext
                            .currentIt_Ze9016_GDElement()
                            .node().moveNext() != null);
               }

	}while (wdContext
		.currentIt_Zepa_Unif_GDElement()
		.node().moveNext() != null);
       }
    }

things that i missed are to add the label and the CB in an element of my layout, but that's no problem, the other thing is the IWDAttributeInfo info, how do I instantiate it?, i don't have an element in the context, do i have to bind something?, is the code ok?, why isn´t it running?, remember its a Dynamic program so if i need a element in the context i have to create it

thanks in advance, any question please tell me

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The DropDownByKey UI element needs a (view) context attribute where it's selected key may be stored.

From the Javadoc:

<b>Data binding:</b>

The set of selectable keys, displayed texts and the selected key are retrieved from a context. This context must provide an attribute y of a type having a value set. The selectable keys of the drop-down list are the keys of this value set, the displayed texts are the corresponding values. The currently selected key is the current value of the attribute y.

The property selectedKey <b>must be bound</b> to the attribute y.

So you have to provide such a context attribute, either one that has been created in the IDE or programmatically.

The value set then will be attached to this attribute such that the drop-down list may use them for the selection list.

You can get the attribute info of a context attribute via it's containing node, e.g.


node.getNodeInfo().getAttribute("<attribute name>")

Another remark: When programmatically creating UI elements, where you are not interested in their ID, you simply may pass NULL as the ID. The framework creates an anonymous ID in this case.

Armin

Former Member
0 Kudos

Hi,

I would like to know as to why do you use the dynamic creation. You can carry use the visibility property to be set to none or blank and visible whenever necessary.

To dynamically populate the dropdownkey the following code would help, I hope,

IwdattributeInfo info=wdcontext.getnodeinfo(),getAttribute(<Attribute name>);

ISimpleTypeModifiable st=info.getmodifiableSimpleTYpe();

IModifiableSimpleValueSet vs =st.getSvServices.getModifiableSimpleValueSet();

vs.put(Object,Value);

Create a simpleType and bind it to the attribute that is being bound to the dropdownkey.

Do post your feedback

Regards

Noufal

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi thanks for the help, i think that i didn't explain well the question; but first about the things you said.

-Another remark: When programmatically creating UI

elements, where you are not interested in their ID, you

simply may pass NULL as the ID. The framework creates

an anonymous ID in this case.

i need to know the id of the different element that i

created dynamically because afterwards when the user

clicks the save button i have to pass the information of

all the dynamic elements that i created.

- I would like to know as to why do you use the dynamic

creation. You can carry use the visibility property to

be set to none or blank and visible whenever necessary

Because i don't know how many DropDowns i have to

create, i depends on the quantity of element brought

by the RFC on the A table.

well the question that i have are :

- about the

node.getNodeInfo().getAttribute("<attribute name>")

i still don't understand what is the "attribute name",

how do i create one dynamically and assign it?, to

what soul i assign it to?, if you could provide

some code it will be very helpful.

- how do i Create a simpleType and bind it to the

attribute that is being bound to the dropdownkey. if

you could provide some code please it will be very

helpful.

thanks in advance.

Former Member
0 Kudos

IWDUIElement ele=wdContext.node<nodename>.getElementAt(i);

ele.getId();

retrieves you the id.

Dynamic creation is handy when you don't know about the screen elements at the design time

Attribute name is the name of the context attribute that you have created.

To create a simple type go to dictionary ->local dictionary-> simpletype. Create simpletype.You can bind this to any context attribute.

Former Member
0 Kudos

Sorry, but this is nonsense.

The return value of IWDNode.getElementAt() is a context node element and not a UI element.

Armin

Former Member
0 Kudos

iwdTransparentContainer container= view.getElement(<container name>);

IWDUIElement ele=container.getChild(int index);

ele.getId();

sorry for the earlier mistake.

Thanx Armin..

Former Member
0 Kudos

No problem, but not quite correct

IWDViewElement element = view.getElement(<id>);
element.getId();

Armin

Former Member
0 Kudos

Guys,

How would I be able to access the name of a node attribute ? I know there are methods to get the value of an attribute, but kinda not sure how to access the name of the attribute.

NodeA

---Attr1

---Attr2

I store the field name as attributes under a value node, created at design time. How can I loop thru the attribute list and get their names. For UI elements there is getId() to get the id of the UI element. Is there a similar one for node attributes ?

I tried the code

IWDAttributeInfo info = (IWDAttributeInfo)wdContext.nodeGeneralFields().getElementAt(i);

fieldNames.add(info.getName());

For some reason the list has null values.

Do let me know.

Thanks !

Former Member
0 Kudos

Iterator it=wdContext.nodeNodeA().getNodeInfo().iterateAttributes();

do{

String name=((IWDAttributeInfo)it.next()).getName();

wdComponentAPI.getMessageManager().reportSuccess(name);

}while(it.hasNext());

Former Member
0 Kudos

Thanks for the code snippet!

Former Member
0 Kudos

Hi,

Iam new to this area.I created a dropdownbykey with a label "Event Name".i created the simple type and bind that simple type to the dropdownbykey and also layout.plese tell me how to write code of dropdownbykey.and give me step-by-step procedure of sample example.