cancel
Showing results for 
Search instead for 
Did you mean: 

Loop elements in context generating Dynamic UI elements

Former Member
0 Kudos

Hello, the problem that i have is that I'm calling an RFC function that return a table with "n" elements in it, i would like to loop this table in the code, an generate dynamically labels and inputfields as the number of elements in the table, how could i do that, the only thing that i don't know how to do is the loop of the table brought by the function call.

please help. thank´s in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi ,

Try this code.. i have tried to give as much details as possible.. if u dont get any just tell me i will explain abt it.

String id = wdContext.nodeLinkDetails().getLinkDetailsElementAt(i).getProjectid();

//We can use input field or dropdown by key here.

IWDInputField inp = (IWDInputField)view.createElement(IWDInputField.class,id);

// Now bind this with a simple type which is either dynamically created or availble in the context.

//call the value help function here..pass the binded simple type as argument

// And add the UI Element to a container or a group.

IWDGroup grp = (IWDGroup)view.getElement("Link");

grp.addChild(link);

}

VALUE HELP

// Now to create value help for elements

ISimpleTypeModifiable stmObj = ISimpleTypeModifiable)wdThis.wdGetAPI().getContext().getModifiableTypeOf(<name of the simple type passed>);

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

int size = wdContext.node.nodeOutput().size();

for(int i=0;i<size;i++)

{

String id = wdContext.nodeOutput().getOutputElementAt(i).getMemeberid();

valueSet.put(id1,id1);

}

Regards,

Bharathwaj

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Sheldon,

The following code may not be directly helps you but this is the way you store data in to a list and loop it

public void wdDoInit()

{

//@@begin wdDoInit()

view_Response r = new view_Response();

String po_ref = r.main();

wdContext.currentContextElement().setPO_Ref(po_ref);

cal = r.getDate();

wdContext.currentContextElement().setDate((cal.get(Calendar.MONTH)1)"/"cal.get(Calendar.DATE)"/"+cal.get(Calendar.YEAR));

List l = r.getItem();

int No_Of_Rows = l.size();

for(int i=0 ; i< No_Of_Rows ; i++)

{

POAsASNType.LineItemsType.ItemType item = (POAsASNType.LineItemsType.ItemType)l.get(i);

IPrivateAdvanceShipView.ILine_ItemsElement table = wdContext.createLine_ItemsElement();

table.setItemCode(item.getItemCode().intValue());

table.setItemDescription(item.getItemDescription());

table.setMaterialNo(item.getMaterialNo());

table.setQuantityRequired(item.getQuantityRequired());

table.setSerialNo(item.getSerialNo().intValue());

wdContext.nodeLine_Items().addElement(table);

}

//@@end

}

Hope this helps you

Regards,

RK

Former Member
0 Kudos

Hi Anilkumar,

about your questions:

Let us say you have 3 columns in the table. You want to create 3 labels and 3 inputfields for that.Am i right ?

the thing really is that i have two tables:

- One whit code and definition of different elements, the definition is the text that i´m going to assign to the different labels that ill create dynamically;

- The second table has values for those different element of the first table, so its like creating dropDownListBoxes, the thing is that depending on the drop Down im creating i have to pass it different information. i.e.

TABLE 1

code definition

SU Sweater

JA Jacket

SH Shoes

TABLE 2

code SIZE USED

SU XL

SU S X

SU M

JA XXL

JA XL X

SH M

SH S

SH L X

Are you looking for complete code ??

yes please.

Regards,

Former Member
0 Kudos

Hi Sheldon,

Incase if you are looking for code for entering values dynamically into a dropdown the it is as follows.

IWDAttributeInfo info(info of the dropdwon key attribute)

ISimpleTypeModifiable st=info.getModifiableSimpleType()

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

vs.put(value,text);

regards

Noufal

Former Member
0 Kudos

when entering values dynamically into a dropdown do i have to assign a context object to the dropdown, or i could simply run de code u passed me, without having a context binding?

Former Member
0 Kudos

Hi,

Create an empty simpletype and bind it to the context attribute(of which you are creating the node info).

Regards

Noufal

Former Member
0 Kudos

Hi,

Looping through the table is nothing but looping through the context.

So first iterate through the context and in the loop generate the UIElements dynamically .

I have one question : Let us say you have 3 columns in the table. You want to create 3 lables and 3 inputfields for that.Am i right ? In that case no need to Iterate thought the context.Depending upon the Context attributes you can generate the UIElements.

Are you looking for complete code ??

Regards, Anilkumar