Get selected elements from a table
Hi all,
I have a requirement like i m enhancing standard component in that i have added one button on click of that i want fetch the selected line item from the table ( which is a normal table). selection mode is auto.
i tried with the following code.
DATA:lr_element TYPE REF TO if_wd_context_element,
lv_index TYPE i.
*--Get selected element
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
****Here itself its throughing dump because lr_element is initial***************
*--get selected element index.
lv_index = lr_element->get_index( ).
can any one help me what is the wrong.. else suggest me how to get the selected elements from a table....
Thanks in advance.
*--Get selected element
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
if lr_element is bound.
lv_index = lr_element->get_index( ).
endif.
Instead you can directly read the node if that row is a lead selected one.
lo_node = wd_context->get_child_node( name = 'EMP' ). "Emp is node name
lo_ele = lo_node->get_lead_selection( ).
or
lv_index = lo_node->get_lead_selection_index( ).
where is the above code written..is it written in OnLeadSelect event of the TABLE..
can any one help me what is the wrong.. else suggest me how to get the selected elements from a table....
As the selection mode is Auto there is no multiple selection..hence try to use the lead selection only.
Edited by: Lekha on Jan 3, 2012 6:47 PM
Similar Messages
-
How to get selected entity from ADF Table
I'm using EJB and ADF Faces.
I have an ADF Table, and when a row is selected I'd like to be able to get the EJB Entity that was selected, is this feasible?
The reason I would like to do it, is for a Dialog. I have a popup dialog, and in the popup the user can do a search. The results are displayed in the ADF table. When supplying the return value from the dialog:
AdfFacesContext.getCurrentInstance().returnFromDialog(?, null);
I would like ? to be the EJB entity representing the row, because I need to return the value of more than one of the columns. Is this not realistic, or should I just add then to a List and pass that back?
thanks
RThanks KUBA,
I hacked some code from the inbuilt JDeveloper Help. Are you saying there is an easier way than this, or did I state the question poorly and you gave an answer to something else? My english is not always perfect.
This is the code that works for me. (cmdSelect is the submit button on the table)
public String cmdSelect_action() {
//Access the tableSelectMany1 table. Note that the table name
//is taken from the id of the table in the JSF page.
CoreTable table = this.getUserResultsTable();
//Obtain a list of all selected rows from the table
Set rowSet = table.getSelectionState().getKeySet();
Iterator rowSetIter = rowSet.iterator();
//Use the declarative method to get the ADF bindings
BindingContainer bindings = getBindings();
//Get the object to delete. To do this, you must get the
//iterator binding for the Products in the page definition file,
//and cast it to DCIteratorBinding for further processing
DCIteratorBinding pr_dcib = (DCIteratorBinding)
bindings.get ("queryUserVFindByFullNameIter");
//Loop through the set of selected row numbers and delete the
//equivalent object from the Products collection.
UserV userV = null;
while (rowSetIter.hasNext()){
//get the table row
Key key = (Key) rowSetIter.next();
//set the current row in the ADF binding to the same row
pr_dcib.setCurrentRowWithKey(key.toStringFormat(true));
//Obtain the Products object to delete
RowImpl prRow = (RowImpl) pr_dcib.getCurrentRow();
//using the generated code to execute the declarative method
userV = (UserV)prRow.getDataProvider();
break;
AdfFacesContext.getCurrentInstance().returnFromDialog(userV, null);
return null;
} -
Get selected row from af:table in backing bean
Hi Experts,
I have an af:table and i have seelctBoolean check box in that. If the user select 'x' nos of check boxes i want to display the row data of those selected rows. Can somebody help me in getting the selected row data in backing bean?
I am using adf faces and backing bean.
JSF Code:
<af:table value="#{demo.partyList}" var="row"
rowBandingInterval="0" binding="#{demo.t1}" id="t21"
rowSelection="multiple">
<af:column>
<af:selectBooleanCheckbox text="#{row.person_first_name}"
label="Label 1" id="sbc1"
/>
</af:column>
<af:column>
<af:inputText value="#{row.emirate}"/>
</af:column>
</af:table>
<af:commandButton action="#{demo.print}" text="Print"/>
BB Code:
public void print(){
// what code to write here
}This is the code
JSF ::
<af:table value="#{createOpportunity.dataList}" var="row"
rowBandingInterval="0" binding="#{demo.t1}" id="t21">
<af:column headerText="Model">
<af:selectBooleanCheckbox text="#{row.modelRange}"
label="Label 1" id="sbc1" value="#{row.selected}"/>
</af:column>
<af:column headerText="Description">
<af:outputText value="#{row.description}"/>
</af:column>
<af:column>
<af:inputText value="#{row.quantity}"/>
</af:column>
</af:table>
<af:commandButton action="#{createOpportunity.print}" text="Print"/>
Backing bean Code::
public void print () {
selectedDataList = new ArrayList<ModelDescription>();
for (ModelDescription dataItem : dataList) {
if (dataItem.isSelected()) {
System.out.println(dataItem.getQuantity());
selectedDataList.add(dataItem);
// dataItem.setSelected(false); // Reset.
Clicking on the print button shows "We have 0 rows selected"
Thnks for ur replies guys ..
Edited by: Wannabe Java Guru on Mar 9, 2011 1:43 AM -
How to get selected value from a Table?
Dear Friends,
when i select a value form the table i want that value to be passed to controller for deleting that record,
please help in understaning what code must i write for the same?
the "Zpms_Master_Input.Output.It_P9001.Employee_Code" is the first field which i want to capture in some context or temp. variable to pass it on to controller for further porcessing.
please give a sample code on how do i catch this employee code value and use it for my processing.
Regards,
Jack
Edited by: Jack on Dec 6, 2011 11:20 AMHi Kumar you have perfectly understood my requirement .... i tried coding as per your suggestion but not able to get through ...it seems with little help i would make it... the code i am writing here is as follows.
input.setMode("DEL" );
P9009 inputParaABC = new P9009();
//inputParaABC.setEmployee_Code("2134"); ---> when i pass a hard coded employee code value i am able to delete
//<your variable> = wdContext.current<tableNodeElement>.get<fieldname> ; --> your suggestion
inputParaABC.setEmployee_Code(wdContext.currentIt_P9009Element().getEmployee_Code());
--> Here as per your suggestion i am not getting a <tableNodeElement> prompt by the system, it only gives
--> wdContext.currentIt_P9009Element() or .createOutputElement etc but no tableNode
the above code i have wriiten on the Controller where in am executing the RFC, how do we adjust the TableNodeElement thing in my code??
Please help. -
Dvt:pivotFilterBar - how to get selected values from filter
Hi all,
I have a question: how to programmatically get selected values from pivot table's filter bar?
I have tried to use
pivotTable.getDataModel().getDataAccess().getValueQDR(startRow, startCol, DataAccess.QDR_WITH_PAGE);but for page edge dimensions it returns BAD DATA, it seems that it returns some cached values.
Environment: JDev 11.1.1.3.0 without any patches.
thanks,
MiroslawHi,
You can retrieve the selected value in the PivotFilterBar through the model of PivotFilterBar, instead of dataaccess:
// get the model from the pivot filter bar instance
QueryDescriptior queryDescriptor = (QueryDescriptor)pivotFilterBar.getValue();
// retrieve a list of criterion, each one is used to populate each lov within the pivot filter bar
ConjunctionCriterion conjunctionCriterion = queryDescriptor.getConjunctionCriterion();
List<Criterion> criterionList = conjunctionCriterion.getCriterionList();
for (int i=0; i<_criterionList.size(); i++) {
AttributeCriterion criterion = (AttributeCriterion)criterionList.get(i);
// _selected is the currently selected value
Object selected = criterion.getValues().get(0);
System.out.println(_selected);
Hope that helps,
Chadwick -
Error while selecting date from external table
Hello all,
I am getting the follwing error while selecting data from external table. Any idea why?
SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
2 SE_CUST_ID NUMBER(38),
3 SE_TRAN_AMT_LCY FLOAT(126),
4 SE_REVERSAL_MARKER VARCHAR2(255))
5 ORGANIZATION EXTERNAL (
6 TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY ext_tables
8 ACCESS PARAMETERS (
9 RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ','
11 MISSING FIELD VALUES ARE NULL
12 (
13 country_code CHAR(5),
14 country_name CHAR(50),
15 country_language CHAR(50)
16 )
17 )
18 LOCATION ('SE2.csv')
19 )
20 PARALLEL 5
21 REJECT LIMIT UNLIMITED;
Table created.
SQL> select * from se2_ext;
SQL> select count(*) from se2_ext;
select count(*) from se2_ext
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04043: table column not found in external source: SE_REF_NO
ORA-06512: at "SYS.ORACLE_LOADER", line 19It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
HTH -- Mark D Powell -- -
How to get string value from database table using Visual Studio 2005?
Hi,
Im developing plugin in illustrator cs3 using visual studio 2005. I need to get the values eneterd in database. Im able to get the integer values. But while getting string values it is returning empty value.
Im using the below code to get the values from database table
bool Table::Get(char* FieldName,int& FieldValue)
try
_variant_t vtValue;
vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
FieldValue=vtValue.intVal;
CATCHERRGET
sprintf(m_ErrStr,"Success");
return 1;
Im using the below code to get the values.
AIErr getProjects()
char buf[5000];
int i;
std::string catName;
::CoInitialize(NULL);
Database db;
Table tbl;
errno_t err;
err = fopen(&file,"c:\\DBResult.txt","w");
fprintf(file, "Before Connection Established\n");
//MessageBox(NULL,CnnStr,"Connection String",0);
if(!db.Open(g->username,g->password,CnnStr))
db.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
fprintf(file, "After Connection Established\n");
if(!db.Execute("select ProjectID,ProjectName from projectsample",tbl))
db.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
int ProjectID;
int UserID;
int ProjectTitle;
char ProjectName[ProjectNameSize];
if(!tbl.ISEOF())
tbl.MoveFirst();
ProjectArrCnt=0;
for(i=0;i<128;i++)
buf[i]='\0';
int j=0;
while(!tbl.ISEOF())
if(tbl.Get("ProjectID",ProjectID))
fprintf(file,"Project ID: %d ",ProjectID);
ProjectInfo[ProjectArrCnt].ProjectID = ProjectID;
sprintf(buf,"%d",ProjectID);
//MessageBox(NULL, buf,"f ID", 0);
j++;
else
tbl.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
break;
//if(tbl.Get("ProjectTitle",ProjectName))
if(tbl.Get("ProjectName",ProjectName))
MessageBox(NULL,"Inside","",0);
fprintf(file,"ProjectTitle: %s\n",ProjectName);
//catName=CategoryName;
ProjectInfo[ProjectArrCnt].ProjectName=ProjectName;
//sprintf(buf,"%s",ProjectName);
MessageBox(NULL,(LPCSTR)ProjectName,"",0);
else
tbl.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
break;
ProjectArrCnt++;
//MessageBox(NULL, "While", "WIN API Test",0);
tbl.MoveNext();
//MessageBox(NULL, ProjectInfo[i].ProjectName.c_str(),"f Name", 0);
::CoUninitialize();
//sprintf(buf,"%s",file);
//MessageBox(NULL,buf,"File",0);
fprintf(file, "Connection closed\n");
fclose(file);
for(i=0;i<ProjectArrCnt;i++)
sprintf(buf,"%i",ProjectInfo[i].ProjectID);
//MessageBox(NULL,buf,"Proj ID",0);
//MessageBox(NULL,ProjectInfo[i].ProjectName.c_str(),"Project Name",0);
return 0;
In the above code im geeting project D which is an integer value. But not able to get the project name.
Please some one guide me.As I said in the other thread, this really isn't the place to ask questions about a database API unrelated to the Illustrator SDK. You're far more like to find people familliar with your problem on a forum that is dedicated to answering those kinds of questions instead.
-
How to get selected values from tableSelectMany
Hi all,
I have a view object which displays all column names of a table. I created a tableselectmany table with the view object.
the user has to select some rows (for mining function).
how to get the selected rows from tableselectmany table?
what should be in 'action' and 'actionlistener' ?
thanks in advance.test(Set<Key> empKeys){
System.out.println("Inside function");
for(Key keys:empKeys){
Row[] row = getCollectionsView1().findByKey(keys,1);
EewCollectionsViewRowImpl vo = (CollectionsViewRowImpl)row[0];
In the action just call this method(test)
and pass the argument as #{applicationScope.managedBean.firstProperty.selectionState.keySet}
I hope this works for you. -
How to get selected value from SelectOneChoice
Hi,
I'm facing a problem to get selected value from SelectOneChoice. I have valueChangeListener event on a (SelectOneChoice)item. After user makes a choice I want to store selected value in a bean property to pass it to a method.
For example List item shows dname from dept table after user makes a choice I want to get deptno and populate into bean which I use to pass into my method.
If I use valueChangeEvent.getNewValue() I always get negative value instead I want deptno selected. Sample code pasted below.
public void setDeptno(ValueChangeEvent valueChangeEvent) {
BindingContainer b = getBindings();
OperationBinding oB = b.getOperationBinding("setDeptno");
//Checking instance of because same method is called from another text inputText item.
if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
if (columnName.getId().toString().equals("deptDname")){
JSFUtils.setManagedBeanValue("dept.deptDeptno",valueChangeEvent.getNewValue());
}if your selectOneChoice has value equal to #{bindings.deptno} bound to the iterator Dept1Iterator,
then the backing code will look more like
public void setDeptno(ValueChangeEvent valueChangeEvent) {
BindingContainer b = getBindings();
OperationBinding oB = b.getOperationBinding("setDeptno");
//Checking instance of because same method is called from another text inputText item.
if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
if (columnName.getId().toString().equals("deptDname")){
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
ValueBinding bind = app.createValueBinding("#{bindings.Dept1Iterator.currentRow}");
Row row = (Row)bind.getValue(ctx);
JSFUtils.setManagedBeanValue("dept.deptDeptno", row.getAttribute("deptno"));
} I haven't tested it, so it could perfectly not work at all -
Copy selected values from a table control into another table control
hi there,
as seen in the subject i need to copy selected values from a table control into another table control in the same screen. as i dont know much about table controls i made 2 table controls with the wizard and started to change the code... right now im totally messed up. nothing works anymore and i don't know where to start over.
i looked up the forums and google, but there is nothing to help me with this problem (or i suck in searching the internet for solutions)
i have 2 buttons. one to push the selected data from the top table control into the bottom tc and the other button is to push selected data from the bottom tc into the top tc. does somebody has a sample code to do this?you're funny
i still don't get it... can't believe, there is no tutorial or sample code around how to copy multiple selected rows from a tc.
here's my code, maybe you can tell me exactly were i have to change it:
tc1 = upper table control
tc2 = lower table control
SCREEN 0100:
PROCESS BEFORE OUTPUT.
MODULE status_0100.
MODULE get_nfo. --> gets data from the dictionary table
MODULE tc1_change_tc_attr.
LOOP AT it_roles_tc1
INTO wa_roles_tc1
WITH CONTROL tc1
CURSOR tc1-current_line.
ENDLOOP.
MODULE tc2_change_tc_attr.
LOOP AT it_roles_tc2
INTO wa_roles_tc2l
WITH CONTROL tc2
CURSOR tc2-current_line.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT it_roles_tc1.
CHAIN.
FIELD wa_roles_tc1-agr_name.
FIELD wa_roles_tc1-text.
ENDCHAIN.
FIELD wa_roles_tc1-mark
MODULE tc1_mark ON REQUEST.
ENDLOOP.
LOOP AT it_roles_tc2.
CHAIN.
FIELD wa_roles_tc2-agr_name.
FIELD wa_roles_tc2-text.
ENDCHAIN.
FIELD wa_roles_tc2-mark
MODULE tc2_mark ON REQUEST.
ENDLOOP.
MODULE ok_code.
MODULE user_command_0100.
INCLUDE PAI:
MODULE tc1_mark INPUT.
IF tc1-line_sel_mode = 2
AND wa_roles_tc1-mark = 'X'.
LOOP AT it_roles_tc1 INTO g_tc1_wa2
WHERE mark = 'X'. -
> big problem here is, that no entry has an 'X' there
g_tc1_wa2-mark = ''.
MODIFY it_roles_tc1
FROM g_tc1_wa2
TRANSPORTING mark.
ENDLOOP.
ENDIF.
MODIFY it_roles_tc1
FROM wa_roles_tc1
INDEX tc1-current_line
TRANSPORTING mark.
ENDMODULE. "TC1_MARK INPUT
MODULE tc2_mark INPUT.
IF tc2-line_sel_mode = 2
AND wa_roles_tc2-mark = 'X'.
LOOP AT it_roles_tc2 INTO g_tc2_wa2
WHERE mark = 'X'. -
> same here, it doesn't gets any data
g_tc2_wa2-mark = ''.
MODIFY it_roles_tc2
FROM g_tc2_wa2
TRANSPORTING mark.
ENDLOOP.
ENDIF.
MODIFY it_roles_tc2
FROM wa_roles_tc2
INDEX tc2-current_line
TRANSPORTING mark.
ENDMODULE.
thx for anybody who can help with this! -
Selecting data from a table which has a LONG column
hi all,
In the table user_views there is a LONG column. Now i want to select rows from that table based on this LONG column. like....
select *from user_views where text like '%account%;
but i am getting the error.."ORA-00932: Inconsistent datatypes:Expected NUMBER got LONG".
How do I overcome this error.
Please give me some suggestions.
Thanks & Regards,
VijayIn the table user_views there is a LONG column. Now i want to select rows from that >table based on this LONG column. like....LONG columns cannot appear in a WHERE or
AND clause. -
How To get selected row in a table
Hi experts
I have been using a table in which I am using a column Tree by nesting . I have written code for dynamically expanding table tree . But I want to know current selected element of the table, for this i have done following
steps
1) created an action on Action <b>lead select </b> of the table .
which has a parameter with type node element .
2) now i need to use parameter mapping in domodify view .
as
IWDTable tab = (IWDTable) view.getElement("CatalogTable");
tab.mappingOfOnLeadSelect().addSourceMapping<b>("XYZ",</b> "element");
But i dont know what is correct parameter <b>XYZ</b> to be passed.
also if i am wrong in approach please let me know .
Regards
AbhayHi
I have used following code also but its not working
IWDTable table = (IWDTable) view.getElement("CatalogTable");
table.mappingOfOnLeadSelect().addSourceMappin ("IWDNodeElement", "LeadSelect");
and I have created an action
public void onActionOnleadSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogElement LeadSelect )
//@@begin onActionOnleadSelect(ServerEvent)
wdContext.currentContextElement().setDebug4(LeadSelect.getID());
//@@end
but when i select one row its giving error
<b>com.sap.tc.webdynpro.services.exceptions.WDIllegalArgumentException: Parameter IWDNodeElement not found</b> -
How to get selected value from selectOneRadio ???
Hi...i want to how to get selected value from selectOneRadio and use it in another page and in backing bean.
Note i have about 10 selectOneRadio group in one page i want to know value of each one of them.
Plzzzzzzzz i need helpYou have a datatable in which each row is a question, correct?
Also in each row you have 5 possible answers that are in a radio, correct?
So,
You need to put in your datatable model, a question, and a list of answers (5 in yor case) and the selected one.
So you will have a get to the question, an SelectItem[] list to populate the radios and another get/set to the selected question.
ex:
<h:selectOneRadio value="#{notas.selectedString}" id="rb">
<f:selectItem itemValue="#{notas.valuesList}"/>
</h:selectOneRadio>
Search the web for examples like yours. -
How to get selected value from OADefaultListBean.
Hi All,
How to get selected value from OADefaultListBean ?
Thanks,Hi,
To identify the user's selection(s) when the page is submitted, you would add the following logic to your processFormRequest() method:
OADefaultListBean list =
(OADefaultListBean)webBean.findChildRecursive("positionsList");
String name = list.getName();
String[] selectedValues = pageContext.getParameterValues(name);
To retrieve all the values in the list box, call list.getOptionsData().
--Prasanna -
How to get the data from Pooled Table T157E.
Hi Experts,
How to get the data from Pooled Table T157E.
Any help.
Thanks in Advance,
Ur's Harsha.create some internal table similar to T157E and pass all data as per SPRAS.
After that use internal table in your program as per the requirement.
Regds,
Anil
Maybe you are looking for
-
Ok so my auto translate feature does not seem to be working. When trying to translate text on twitter or any page I highlight the text, right click and the option to auto translate has gone. I am running firefox v5 on vista. Can anyone help me out. t
-
I have wireless DSL (Verizon). If I want a wired connection (since it's faster) what kind of cable do I need?
-
Mbp late 2009- switching from 9600/9400
Is it not possible to set the graphics card to use the 9600 when connected to a power source and the 9400 when its on battery power I see the setting to allow me to change this- but whenever I switch one setting (the other one changes as well) cant f
-
Firewall error now won't turn on
last night i received the firewall error message, and today my nano will not turn on. i've checked everything, but nothing is working. when i plug it into my computer, the screen flashes blank once,and then goes black again. the 5 r's did nothing. wh
-
Can size of images in .fla file be edited?
The home page of our site (http://checkoutacollege.com/) uses Flash animation that was created by an agency outside of our organization. We are undergoing a site redesign and are interested in giving our Flash characters less real estate, so I am try