How to bind an element in an arrayList to a table column
Hi everyone, I need your help.
I have an ObjectListDataProvider to bind a class MyClass to a table. Inside of MyClass, there is a property called dynNumOfElements of type ArrayList. I need dynamically create the columns of the table to match the number of elements in ArrayList, and bind each element in the ArrayList to a column.
However I dont know how to do it? It is going to be something like createValueBinding("#{currentRow.value(['dynNumOfElements[1]']}"). Obviously this does not work.
Can you tell me a way to solve this problem?
Is it possible to bind a column to an element in a collection?
Thanks in advance
Thanks Winston,
Following is what I did. They are all in Page1.jsp
public String getMyData(){
// Make sure to check for nulls
return myList.get(count++).toString();
private ArrayList myList = new ArrayList();
private int count = 0;
public String button3_action() {
// TODO: Replace with your code
//initialize list
myList.add("string 1");
myList.add("Stirng 2");
myList.add("string 3");
TableColumn tc1 = new TableColumn();
tc1.setId("tc1");
tc1.setHeaderText("tc1");
tableRowGroup2.getChildren().add(tc1);
StaticText st1 = new StaticText();
st1.setValueBinding("text", getApplication().createValueBinding("#{Page1.myData}"));
tc1.getChildren().add(st1);
return null;
The error message is "Error getting property 'getMyData' from bean of type helloweb.Page1"
Can you help me to fix the problem? Thanks a lot.
Similar Messages
-
How to shuffle the elements in an ArrayList?
Hi, everyone
I write the following method to shuffle the elements of an ArrayList of Question type, and then Print the questions out
public void shuffle()
System.out.println ("This is a test created randomly");
Random generator = new Random ();
for (int i = 0; i < questions.size(); i++)
int randomQuestion = generator.nextInt(questions.size());
Question temp1 = questions.get(i);
Question temp2 = questions.get(randomQuestion);
Question temp3 = temp1;
temp1 = temp2;
temp2 = temp3;
System.out.println ("" + (i+1) + ". " + questions.get(randomQuestion).getQuestion()+"\n");
} But I find that the elements of the ArrayList have not been swapped, why?
Thank you.temp1, temp2 and temp3 are all local variables. They're put on the stack at the beginning of the function and popped off at the end. You are never modifying the collection.
-
How to bind values for input parameters from an adf table?
Hi,
The version I am using is
Jdev TP4 11.1.1.0.0
I need to know how to bind values for input parameters to methods.
I have created an af:table and I have a button created using a method which is outside the af:table. This method needs to take input parameter values from the column values in the table.
When I have an adf form instead of the table the binding works.
Any help?
Thanks.Hi Balaji,
you need to bind you table to a backing bean and call a method in the backing bean when you hit the button. In the method you get the selected row from the table and have access to the columns of it. Then call the the method with the parameters.
To bind the table to a bean select the properties of the table, go to behavior section and look for the advanced section 'Binding' property.
Select the small down arrow at the right side and click edit. In the dialog select or create a bean and property for the table.
Go to the button properties, look for 'Action', again select the small down arrow and click 'Edit'. Select the bean which holds the table property and create a method for the button.
The method look like public void bearbeitenQuelle(ActionEvent actionEvent)
// Add event code here...
RichTable lTable = getYourTable();
Object lData = lTable.getSelectedRowData();
FacesCtrlHierNodeBinding lNB = (FacesCtrlHierNodeBinding) lData;
YourViewRow lRow = (YourViewRow ) lNB.getCurrentRow();
}Hope the get you started
Timo -
How to bind UI Element with Context Node Attribute Element
Hi,
I'm building my view dynamically in the wdDoModifyView method.
Is it possible to bind a "TextView" element to a specific element of an attribute node?
Scenario:
Node_Employees
|
+- Attribute_Code
|
+- Attribute_Name
Node Contents:
Employees
|
+- Code: 1, Name: Employee 1
|
+- Code: 2, Name: Employee 2
|
+- Code: 3, Name: Employee 3
I need to do something like binding a TextView UI element to the "Name" attribute of the element #2, what would result to show "Employee 2" on my view.
How can I do this?
Thanks in advance,
Geraldo.Hi Saravanan,
First I populate the context node and it won't change during view's lifecycle. After that, I build my view and bind the TextView UI elements to the node context attributes elements.
If the node has 10 elements, I will build 10 TextView UI elements and bind them to each attribute element.
Regards,
Geraldo Brígido. -
How to bind the values of a RFC to a table element in WDA
Hi,
I have a RFC that returns some set of rows for a particular pernr.I want to bind this RFC to a table element in WDA.
please let me know how to do this and points will be rewarded for the helpful anwersHi,
Pl post in Web Dynpro ABAP
This tutorial may help https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7a89b067-0801-0010-8192-a9896a60938e
If its WD java
bind the datasource to the RFC model node
Regards
Ayyapparaj -
How to bind Context elements to a HTML template
Hi,
I want to display all the context elements in my webDynpro application in a html page, I have html template my requirement is to bind all the context elements to fields in the html template.please provide me the solution.
thanks,
kishore.Hi Kishor,
I do not think there is some straight forward solution for this scenario.
You need to create two applications 1 webdynpro application and one portal application.
What you can do is Pass the context values from webdynpro application to a flat file and store then in that(every time create a new flat file). Now after successfully creation of flat file call the portal application which reads the flat file and get the context values and set them.
If you require more info, i can help you.
Regards
Narendra -
How to bind the interactive form with a header/detail table.
Hi there,
I'm having problem to bind the adobe form with my detail table.
When executing the layout after doing the binding, the detail fields in the form is repeating itself on all the rest of the rows for that column???Is the cardinality on the context correct? Have you tried displaying this same context using a web dynpro table instead?
-
How to bind webdynpro abap context attributes with interactive form table
hi,
I was created table in interactive form and add the all context attributues to each column of the table.
And add the table into the subform.
i want to bind the table using bapi values form Webdynpro abap.
please give the detailed explanation.
by
ParthasarathiHey Lingam,
Check out this link...
[Inserting a Table or Loop|http://help.sap.com/erp2005_ehp_04/helpdata/EN/4c/9cc19e5c874091a99790e540b06f3a/frameset.htm]
It's for EhP4, so I'm not sure if it would apply.
Hope this helps...
Cheers,
Kevin -
How can I create checkbox as many as the current table column?
I have an table that binds from emploeyeeView,.. I want to create some checkbox as many as the number of the column that is shown,..how can i do that?
thanks,
Amir,,..You are going to want a <af:selectManyCheckbox>. Try this:
<af:selectManyCheckbox label="Label 1" value="#{myBackingBean.selectedAttributes}>
<af:forEach items="#{bindings.EmpView1Iterator.attributeDefs}"
var="item">
<af:selectItem value="#{item.name}" label="#{item.name}"/>
</af:forEach>
</af:selectManyCheckbox>In the backing bean named "myBackingBean" there will be a "String[] selectedAttributes" with getter and setter methods. When the form is submitted, this will contain the names of the attributes that the user selected. -
How to find out to find by which procedure a table column was updated
Hi All,
We have an attribute10 column of a table used in a DFF.
This attribute is being updated for a specific reason in a code, but some other procedure is also updating the same column which is causing issue with the functionality. The update might be using an API or some other way.
Can anyone help me with a query or some other way to in find out the procedures which might be updating a particular column (attibute10) of that table.
Regards,
ShrutiShruti,
If you can replicate in non-production environment, one way is to create an update trigger on the table/column,and have the trigger do something with any environmental info you can query (select SYS_CONTEXT('USERENV','OS_USER'), etc.) and write it using utl_file or insert it into a custom table. Perhaps have the trigger enable trace, query the above and disable trace.
-Vince -
How to create dynamic VO and attach it to a table column
Hello frnds,
Hope all are doing good.
I have a small doubt on dynamic view object.
i need to create a new VO and need to initilize the VO when the page loads.
so for this i have created a new VO dynamically . so, here i have a doubt , the VO query has 2 columns
my doubts is:
1. do i need to expliciltly create a new attribute for the VO i.e i mean like vo.addDynamicAttribute("MEANING");
should i need to create 2 new attributes for the VO or not needed ?
2.i need to assign these 2 dynamic VO attributes to a messageStyledText items in a advanced table.
so,should i create messageStyledText through personalization and assign the view attribute and view instance to it or not ??Hi Guys , thank you for ur help and support
i got the code, here is my working code
OAAdvancedTableBean tableBean = (OAAdvancedTableBean)oawebbean.findIndexedChildRecursive("DocumentTable") ;
OASortableHeaderBean sortableHeaderBean =(OASortableHeaderBean)oapagecontext.getWebBeanFactory().createWebBean(oapagecontext, SORTABLE_HEADER_BEAN);
sortableHeaderBean.setTextBinding("headerText");
sortableHeaderBean.setSortableBinding("isSorted");
OASortableHeaderBean sortableHeaderBean1 =(OASortableHeaderBean)oapagecontext.getWebBeanFactory().createWebBean(oapagecontext, SORTABLE_HEADER_BEAN);
sortableHeaderBean.setTextBinding("headerText");
sortableHeaderBean.setSortableBinding("isSorted");
OAColumnBean column1 = (OAColumnBean)createWebBean(oapagecontext, COLUMN_BEAN, null, "UseridCol");
column1.setColumnHeader(sortableHeaderBean);
DictionaryData data1 = new DictionaryData("headerText", "Document Browse");
column1.setColumnHeaderData(data1);
OAColumnBean column2 = (OAColumnBean)createWebBean(oapagecontext, COLUMN_BEAN, null, "UploadCol");
column2.setColumnHeader(sortableHeaderBean1);
DictionaryData data2 = new DictionaryData("headerText", "Upload Button");
column2.setColumnHeaderData(data2);
//OAMessageFileUploadBean uploadBean = (OAMessageFileUploadBean)createWebBean(oapagecontext, MESSAGE_FILE_UPLOAD_BEAN, null, "FileUploadBeanID");
OAMessageFileUploadBean uploadBean = (OAMessageFileUploadBean)createWebBean(oapagecontext, OAWebBeanConstants.MESSAGE_FILE_UPLOAD_BEAN,null,"FileUploadBeanID");
uploadBean.setPrompt("Document Upload");
uploadBean.setViewUsageName("IrcDocumentsVO");
uploadBean.setViewAttributeName("FileName");
//uploadBean.
OASubmitButtonBean uploadbutton =(OASubmitButtonBean)oapagecontext.getWebBeanFactory().createWebBean(oapagecontext, "BUTTON_SUBMIT");
uploadbutton.setID("UploadButton");
uploadbutton.setViewUsageName("IrcDocumentsVO");
uploadbutton.setServerUnvalidated(true);
//uploadbutton.
uploadbutton.setViewAttributeName("Description");
uploadbutton.setUINodeName("UploadButton");
uploadbutton.setEvent("UploadDoc");
uploadbutton.setText("Upload Documents");
column1.addIndexedChild(uploadBean);
column2.addIndexedChild(uploadbutton);
tableBean.addIndexedChild(column1);
tableBean.addIndexedChild(column2);
Edited by: 881533 on Oct 27, 2012 4:59 AM -
Trigger how to get new and old value for nested table column?
Hi,
I have created a nested table based on the following details:
CREATE TYPE typ_item AS OBJECT --create object
(prodid NUMBER(5),
price NUMBER(7,2) )
CREATE TYPE typ_item_nst -- define nested table type
AS TABLE OF typ_item
CREATE TABLE pOrder ( -- create database table
ordid NUMBER(5),
supplier NUMBER(5),
requester NUMBER(4),
ordered DATE,
items typ_item_nst)
NESTED TABLE items STORE AS item_stor_tab
INSERT INTO pOrder
VALUES (800, 80, 8000, sysdate,
typ_item_nst (typ_item (88, 888)));
Now I would like to create a trigger on table pOrder for after insert or update or delete
and I would like to track the new and old value for the columns inside nested table.
Can anybody direct me how to do it?
I would like to know the sytax for it like:
declare
x number;
begin
x := :new.nestedtablecolumn;--how to get the new and old value from nested table columns
end;
Hope my question is clear.
Thanks,
LavanHi,
Try like this:
CREATE OR REPLACE TRIGGER PORDER_I
BEFORE INSERT
ON PORDER
REFERENCING OLD AS old NEW AS new
FOR EACH ROW
DECLARE
items_new typ_item_nst;
ordid_NEW NUMBER;
BEGIN
FOR i IN :new.items.FIRST .. :new.items.LAST LOOP -- For first to last element
DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').prodid: ' || :new.items(I).prodid );
DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').price: ' || :new.items(I).price );
END LOOP;
END;Regards,
Peter -
Sample code is required on how to use TableUI element in ArrayList
Hi all
Can any body send the sample code on how to store Table UI element in Arraylist.
Regards
Suresh babuHi I am providing two methods of it. Just go through and try. This will defenately solve your problem
I. METHOD
Try This
//@@begin others
//this is the array used in the program
String emp[][]=
{"nikhil","tapkir","pune"},
{ "juhi","bhatnagar","delhi"},
//@@end
i have to insert the above information in a table wid columns firstname lastname and city .
u need to use the for loop to insert the data in the table for more than 1 record
code the following thing in wd init
here fname lname and city are my value attributes mapped to my table columns.
for (int i=0;i<emp.length;i++)
IPrivateTabappView.ITablenodeElement tnode=wdContext.createTablenodeElement();
tnode.setFname(this.emp<i>[0]);
tnode.setLname(this.emp<i>[1]);
tnode.setCity(this.emp<i>[2]);
wdContext.nodeTablenode().addElement(tnode);
i hope this is what ur doubt was if not pls clarify.
hope this helps u.
II METHOD
For example: Consider that the value node DataNode having two attributes A and B is bound to the DataSource property of your Table UI Element.
IDataNodeElement objDataNode = null;
ArrayList arlDataNode = null;
int size = 0;
size = <No. of rows that you want in the table>;
arlDataNode = new ArrayList();
for(int i=0;i<size;i++)
objDataNode = wdContext.createDataNodeElement();
objDataNode.setA(<Set some values>);
objDataNode.setB(<Set some values>);
arlDataNode.add(objDataNode);
wdContext.nodeDataNode.bind(arlDataNode);
Hope, You can resolve your problem. Revert me if you have any doubts.
Regards
Raghu -
How to bind a UI element to the context
Hi Experts,
I have a problem binding UI element to the context. In my code i have to create TabStrips dynamically and under this tabstrip number of UI elements would be there. For this i have a code like this..
IWDTransparentContainer theActionContainer =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
IWDTabStrip ts = (IWDTabStrip) view.createElement(IWDTabStrip.class,"TabStrip");
IWDTab tab1 = (IWDTab) view.createElement(IWDTab.class,"Tab1");
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
IWDCaption header1 = (IWDCaption) view.createElement(IWDCaption.class,"Header1");
header1.setText("Tab1");
tab1.setContent(in);
ts.addTab(tab1);
IWDTab tab2 = (IWDTab) view.createElement(IWDTab.class,"Tab2");
IWDInputField in2 = (IWDInputField) view.createElement(IWDInputField.class,"in2");
IWDCaption header2 = (IWDCaption) view.createElement(IWDCaption.class,"Header2");
header2.setText("Tab2");
tab2.setHeader(header2);
ts.addTab(tab2);
theActionContainer.addChild(ts);
<b>when i run this code it is giving following exceptions..</b>
The initial exception that caused the request to fail, was:
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Property 'value' of AbstractInputField with id 'in' in view 'LoginView' must be bound to the context
at com.sap.tc.webdynpro.clientserver.uielib.standard.impl.AbstractInputField.getValue(AbstractInputField.java:1260)
at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.InputFieldAdapter.getValue(InputFieldAdapter.java:582)
at com.sap.tc.ur.renderer.ie6.InputFieldRenderer.render(InputFieldRenderer.java:56)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:435)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:134)
... 63 more
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Property 'value' of AbstractInputField with id 'in' in view 'LoginView' must be bound to the context
at com.sap.tc.webdynpro.clientserver.uielib.standard.impl.AbstractInputField.getValue(AbstractInputField.java:1260)
at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.InputFieldAdapter.getValue(InputFieldAdapter.java:582)
at com.sap.tc.ur.renderer.ie6.InputFieldRenderer.render(InputFieldRenderer.java:56)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:435)
at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:134)
at com.sap.tc.ur.renderer.ie6.TabStripRenderer.renderTabStripItemContentFragment(TabStripRenderer.java:1867)
at com.sap.tc.ur.renderer.ie6.TabStripRenderer.renderTabStripFragment(TabStripRenderer.java:838)
From these exceptions what i understood is, i need to bind these UI elements to context.
Can any body tell me how to bind a UI element to the context if I understood the exceptions correct..
Thanks in Advance,
Murthy.HI,
lets say Ctx is your context attribute,
IWDAttributeInfo attrInfo = wdContext.getNodeInfo.getAttribute("Ctx");
then , as per your code,
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
<b>in.bindValue(attrInfo);</b>
if your contex attribute is child of some other node then do like this,
IWDAttributeInfo attrInfo = wdContext.getNodeInfo.getChildNode("SalesOrder",0)getAttribute("Ctx");
//this is when Ctx is child of node SalesOrder, and we are taking Ctx from its 0th element
then ,
IWDInputField in = (IWDInputField) view.createElement(IWDInputField.class,"in");
<b>in.bindValue(attrInfo);</b>
include this in your code ,
let me know if you face any problem
regards
reward points if it helps -
How can i get all elements from a arraylist
Hello everyone
I have an arraylist with 40 elemets inside it.
I want to be able to get the first 10 elements of the arraylist and put them into a sql statement (I can do this ok) but the problem is when i want to get the next 10 elements (from 10 to 20) they will not execute to the database. is this possible with just one prepared statement?
thanks
piperHello Ken this is my code so far, And i keep getting the error
binary data would be truncated.
And if i change the values in the for loop i get an exception null.
I do not know what is wrong with this so could you be so kind as to. help me thaks
piper
try {
String data = "jdbc:odbc:myProject";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(data,"","");
int rows=0;
PreparedStatement ps = conn.prepareStatement(
"INSERT INTO Ben (Phone,addr1,addr2,PostCode) VALUES (?,?,?,?)");
Iterator io = arr3.iterator();
while (io.hasNext())
for (int pos = 1; pos <=4; pos++)
String sf = (String)io.next();
ps.setString(pos,sf);
rows += ps.executeUpdate();
System.out.println("inserted" + rows + " rows");
ps.close();
return;
}catch (Exception e1) {
System.err.println("Got an exception! ");
System.err.println(e1.getMessage());
Maybe you are looking for
-
My right click on windows, running on mac
right ive installed windows xp home edition on my macbook, and its running smoothly, and there isnt realy any problems, apart from my right click will not work. is this a case of it wont work because its a 1 click button or should it work, if it shou
-
How to create PO with ref to SO using BAPI_PO_CREATE1
Hello Experts, I have to create a PO using Sales Order(approved in work flow, User status will be changed from ZBLK to ZAO) in my User exit userexit_save_document. BAPI_PO_CREATE1 can be used to create PO. But I need it with reference to Sales Order.
-
Error when sending control recipe to external destination
Hi, When Iam trying to send control recipe to external destination through CO53, Iam getting the status of the control recipe as 'Sent'. But when I check the tRFC log, I get the status, "connection closed (no data) ". By selecting the line in the log
-
T-Codes VA01 - To create RETURN order VA03 - To DISPLAY the return order VL01N - To create RETURN DELIVERY ORDER. VL06O - POSTING GOOD Reciept. VF04* - For BILLING It is a ETE bussiness of above T-Codes In VF04(BILLING) i am not able to find my creat
-
Iphone4 is lagging when rotating anything ???!!!
hey guys , i've got a problem with my iphone4 . whenever i am rotating it to flip any picture or some apps or the safari sometimes it laggs or it doesnt flip untill i give it a touch on the side , but sometimes it rotates normally so whats the proble