Cannot select different values from a table in a view object
Hi everyone,
I have two tables, Employee : ID, NAME, SALARY, NO_ROLE and role : ROLE_ID, ROLE_EMP. I join them with NO_ROLE and ROLE_ID. I created a view object with these two tables in JDeveloper, I made a LOV with ROLE_EMP and I want to be ale to create an employee with his ID, NAME, SALARY and by choosing a value in the ROLE_EMP list. The problem is that when I choose a ROLE_EMP, I cannot commit because the link between ROLE_EMP and ROLE_ID is not made correctly in ADF.
In SQL, that's what I'm trying to do: INSERT INTO Employee VALUES (ID, NAME, SALARY, NO_ROLE) WHERE NO_ROLE = ROLE_ID of the ROLE_EMP I have selected.
Thanks for your help ;)
PS: I followed this tutorial to do this, but it is not exactly what I want to do: http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_55/jdtut_11r2_55_2.html
To be more generic, when I create an employee and select his role_emp (the name of the role) I want that the role_id of the role_emp to commit.
Similar Messages
-
Need of SQL query in selecting distinct values from two tables
hi,
I need a query for selecting distinct values from two tables with one condition.
for eg:
there are two tables a & b.
in table a there are values like age,sex,name,empno and in table b valuses are such as age,salary,DOJ,empno.
here what i need is with the help of empno as unique field,i need to select distinct values from two tables (ie) except age.
can anybody please help me.
Thanks in advance,
RatheeshNot sure what you mean either, but perhaps this will start a dialog:
SELECT DISTINCT a.empno,
a.name,
a.sex,
b.salary,
b.doj
FROM a,
b
WHERE a.empno = b.empno;Greg -
How to select distinct values from a table when it has composite primary ke
Hi
I have the requirement like , I need to select distinct one column values from the table which has composite primary key. How to acheive this functioinality using view object.
Eg : Table 1 has col1 and col2, col3
col1 col2 col3
1 A NA
1 B NA
2 A NA
3 C NA
2 D NA
primary key (col1,col2)
I have to select distinct col1.
ThanksHi
I got the solution for above. By Creating the read only view object we can acheive this.
thanks -
Selecting Max Value from Huge Table
Dear Proffessionals
I have a huge table (20,000,000+ records) with the following columns:
[Time], [User], [Value]
The values in [Value] column can recur for a single User at a Time e.g.
2015-01-01, Me, X
2015-01-01, Me, Y
2015-01-01, Me, X
2015-01-02, Me, Z
2015-01-02, Me, X
2015-01-02, Me, Z
For each day, and for every user I want to have the maximum recurring value :
2015-01-01, Me, X
2015-01-02, Me, Z
to be inserted into another table.
PS: I want the MOST optimized way of achieving this functionality, bcause I am expecting a growth on the raw table over time, so PERFORMANCE is of great consideration.
I would really appreciate it, if somebody can help me.
RegardsI can think of two techniques based on the data selecticity
1) using row number function
2) using cross apply operator
USE Northwind;
-- Solution 1
SELECT S.SupplierID, S.CompanyName, CA.ProductID, CA.UnitPrice
FROM dbo.Suppliers AS S
CROSS APPLY
(SELECT TOP (10) *
FROM dbo.Products AS P
WHERE P.SupplierID = S.SupplierID
ORDER BY UnitPrice DESC, ProductID DESC) AS CA
ORDER BY S.SupplierID, CA.UnitPrice DESC, CA.ProductID DESC;
-- Solution 2
WITH C AS
SELECT S.SupplierID, S.CompanyName, P.ProductID, P.UnitPrice,
ROW_NUMBER() OVER(
PARTITION BY P.SupplierID
ORDER BY P.UnitPrice DESC, P.ProductID DESC) AS RowNum
FROM dbo.Suppliers AS S
JOIN dbo.Products AS P
ON P.SupplierID = S.SupplierID
SELECT SupplierID, CompanyName, ProductID, UnitPrice
FROM C
WHERE RowNum <= 10
ORDER BY SupplierID, ProductID DESC, UnitPrice DESC;
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to make validation in Bean and select value from another table
I want to know how to select data from table in backing bean according to primary key i have
the problem is that
i have a table Employee_Salary contains Employee ids and their salary
Empoloyee_Salary table
Employee_ID Number
Employee_salary Number
And Another table Called Employees
Employees table
Employee_ID Number
IsManager Varchar2 its value is [*Yes or NO*]
and other columns that i don't care about this table
i have on a jsff page an <af:table> this table is editable this is the Empoloyee_Salary table
*i want to check before save or after insert if this employee is Manager [from Employees tabke(yes or no)] the salary*
cannot be less that 100
i want to know how to make this how to select the value from employees table according to the id i have in the employee_salary table how to make this and make this validation
i have to select IsManager from Employees Table to see if this manager or no
i want to know how to make this in a bean
i use jdeveloper 11g
and my project is ADF Fusion project
and the page that have the Emplpyee_Salary table is JSFF
thanks in advanceYou might want to write this code in a validator on the entity object if it should apply from every screen.
If you want to access view objects from a backing bean the basics are here: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcservices.htm#sthref918 -
Selecting multiple values from a search help
Hi Experts
Anyone knows if it is possible to select multiple values from a search help?
Thanks
GauravHi,
You cannot select mutiple values from search help as it is linked to inputfield and hence it will accept single value only. But at the same time, you may able to pass row of values to different inputfields.
Refer http://help.sap.com/saphelp_dm40/helpdata/en/3d/e53642e2a3ab04e10000000a1550b0/content.htm
Thanks,
Chandra -
Get selected row values from Table view control
Hi ,
I am using transaction ME23N, would like to access row values from item table for selected row. I have written a script as in screen shot and its giving me error at java script step two. I want to get the PR number from item table for selected row.
With Regards
Vishal LokapurH Vishal,
Can you please share how you were able to resolve the issue regarding the selected row
in case of a table control .
Regards -
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! -
How to update value stored in a table when we select a value from a list
In my jsp page i have given
<html:select property="function" >
<html:option value="select">Select Actions</html:option>
<html:option value="open">Marks as open</html:option>
<html:option value="closed">Marks as closed</html:option>
</html:select>
I am using lookup dispatch action in action class
public class LoginAction extends LookupDispatchAction{
protected Map getKeyMethodMap() {
Map map=new HashMap ();
map.put("open","open");
map.put("closed","closed");
return map;
public ActionForward open(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
System.out.println("success");
return mapping.findForward("success");
public ActionForward closed(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
System.out.println("success");
return mapping.findForward("success");
but when i select a value from the list,the corresponding action is not occuring.What should i put in my code??Put your code between the code tags, it makes it so much easier to read.
To do that, just highlight your code and click on the "code" found between " and the circled ?.
From what I can read of your code I don't even see a table or a list, so i have no idea what you are trying to do. You probably need to show more code.
JSG -
Fetching more than one row from a table after selecting one value from the dropdown
Hi Experts,
How can we fetch more than one row from a table after selecting one value from the dropdown.
The scenario is that I have some entries in the dropdown like below
A B C
11256 VID 911256
11256 VID 811256
11256 SONY 11256
The 'B' values are there in the dropdown. I have removed the duplicate entries from the dropdown so now the dropdownlist has only two values.for eg- 'VID' and'SONY'. So now, after selecting 'VID' from the dropdown I should get all the 'C' values. After this the "C' values are to be passed to other methods to fetch some data from other tables.
Request your help on this.
Thanks,
Preeetam Narkhede.Hi Preetam!
I hope I understand your request proberly, since this is more about Java and less about WebDynpro, but if I'm wrong, just follow up on this.
Supposed you have some collection of your original table data stored in variable "origin". Populate a Hashtable using the values from column "B" (let's assume it's Strings) as keys and an ArrayList of whatever "C" is (let's assume String instances, too) as value (there's a lot of ways to iterate over whatever your datasource is, and since we do not know what your datasource is, maybe you'll have to follow another approach to get b and c vaues,but the principle should remain the same):
// Declare a private variable for your Data at the appropriate place in your code
private Hashtable temp = new Hashtable<String, ArrayList<String>>();
// Then, in the method you use to retrieve backend data and populate the dropdown,
// populate the Hashtable, too
Iterator<TableData> a = origin.iterator();
while (a.hasNext()) {
TableData current = a.next();
String b = current.getB();
String c = current.getC();
ArrayList<String> values = this.temp.get(b);
if (values == null) {
values = new ArrayList<String>();
values.add(c);
this.temp.put(b, values);
So after this, you'll have a Hashtable with the B values als keys and collections of C values of this particular B as value:
VID --> (911256, 811256)
SONY --> (11256)
Use
temp.keySet()
to populate your dropdown.
After the user selects an entry from the dropdown (let's say stored in variable selectedB), you will be able to retrieve the collection of c's from your Hashtable
// In the metod you handle the selection event with, get the c value collection
//and use it to select from your other table
ArrayList<String> selectedCs = this.temp.get(selectedB);
// now iterate over the selectedCs items and use each of these
//to continue retrieving whatever data you need...
for (String oneC : selectedCs) {
// Select Data from backend using oneC in the where-Clause or whatever...
Hope that helps
Michael -
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. -
How to select and field from an table with similar value
Hi Gurus,
I got an requirement where i need to capture some values from an table whose value start with "vmr*"
could anyone tell me the syntax to be used with this?
My table contains valies like "lrt", "vmr'" nut i need only values starting with "vmr"*
RaviHi,
In where clause, you can write,
where field like 'vmr%'.
Hope this helps.
Reward if helpful.
Regards,
Sipra -
Values from CRCO Table.
Hi all ,
I need to retreive some values from CRCO table based on the balues fetched from AFRU table. I am writing a select like this
select single KOKRS KOSTL into table itab from CRCO
where OBJTY = 'A'
and OBJID = AFRU-ARBID
and ENDDA >= AFRU-BUDAT
and BEGDA <= AFRU-BUDAT.
As I need to retreive a single record from above select, but as a result i am getting multiple records.
Can anybody tell me what other keys from AFRU I can specify in the select in order to fetch only a single record.
Thanks,
Mungala.Object ID you can get from ARBID from AFRU Table. Put value of ARBID in OBJID in table CRCO & get values of KOKRS & KOSTL. That value will be unique for an work center But if ARBID values are many for an AUFNR(order no.) that mean you are using different work center where in may be you are using different cost center(i think controlling area will remain same). & hence SAP creates different records.
Regards
Prashant Jaiswal -
I have a table with info and would like to select an item from that table
Hi
I have a table with info (course info that I searched for) and would like to select an item from that table to use for further use in my application.
It must work more or less like the tree structure where I can use an On Action select.
In other words; let say I am looking for all courses with "Advisor" it its descriptin / name, I want to click on one of the names and use it lets say to book people on.
Could some please assist me with this.
Regards
DebbieHi
The datasource for my table is the node searchcatalog. Under this node there is an attribute calles description where the items found are displayed.
I changed my code as follow:
data: ls_table type wd_This->Elements_searchcatalog,
lr_element type ref to if_wd_context_element.
DATA lo_nd_searchcatalog TYPE REF TO if_wd_context_node.
DATA lo_el_searchcatalog TYPE REF TO if_wd_context_element.
DATA ls_searchcatalog TYPE wd_this->element_searchcatalog.
navigate from <CONTEXT> to <SEARCHCATALOG> via lead selection
lo_nd_searchcatalog = wd_context->get_child_node( name = wd_this->wdctx_searchcatalog ).
@TODO handle not set lead selection
IF lo_nd_searchcatalog IS INITIAL.
ENDIF.
get element via lead selection
lo_el_searchcatalog = lo_nd_searchcatalog->get_element( ).
@TODO handle not set lead selection
IF lo_el_searchcatalog IS INITIAL.
ENDIF.
get all declared attributes
lo_el_searchcatalog->get_static_attributes(
IMPORTING
static_attributes = ls_searchcatalog ).
lo_nd_searchcatalog->get_lead_selection->( exporting index = wdevent->index importing
element = lr_element ).
lr_element->get_static_attributes->( importing static_attributes = ls_table ).
wd_context->set_attribute( exporting name = 'SELECTED' value = ls_table-description ).
When I try to activate it errors with: List elements that take up more than one line is not allowed. This error at the sentence: lo_el_searchcatalog->get_static_attributes(
If you cannot assist me further I will understand. Thank you. -
Updatable View issues: cannot select FOR UPDATE from view with DI
Hi All,
I have a simple view XY and an instead of trigger on that to insert data into one table which is used in the my view. When I do insert statement on view XY it is working fine from sql but when i used same thing with page process of " Process Row of XY Automatic Row Processing (DML) " i am getting following error. I am using APEX 3.0 . Please help me.
ORA-20001: Error in DML: p_rowid=xxxx, p_alt_rowid=abc, p_rowid2=, p_alt_rowid2=. ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
ThanksJames,
are you already on 3.0.1.00.07 or 3.0.1.00.08? Have a look at the release notes, it says something about a bug fix for some occurrences of ORA-02014.
Also have a look at the new substitution value/item FSP_DML_LOCK_ROW which turns locking off if you set it to FALSE. See http://www.oracle.com/technology/products/database/application_express/html/3.0.1_readme.html#CHDIDIAF and also http://download-west.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/advnc.htm#BCGFDAIJ
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://apexplugin.sourceforge.net/ New!
Maybe you are looking for
-
The home page fills my entire screen now and it didn't before. This happened about a week ago. I tried to do a Restore on my system but the problem still exists. The Firefox button on the left has disappeared too.
-
My BB Pearl 8130 from US Cellular keeps turning on and off all by itself. Any Help?
This never happened before, it's been doing it now for about 3 or 4 hours. It's driving me nuts. Someone help me please. Thanks in advance.
-
Suddenly, my videos on the iPhone5 have no sound.
Suddenly videos on my iPhone 5, which were fine before, have no sound. I've searched in "Settings" but find nothing that applies to sound for videos. I'm wondering if I'm looking in the wrong place.
-
Upload songs from multiple computers?
Has anyone figured out if there is a way to UPLOAD songs from multiple computers. Note, I don't want to sync. I want to be able to plug my iPhone in at my office and put mp3s which I buy at work onto the phone. This works on the iPod, but not the iPh
-
Is it possible for Apple Time Capsule place iphoto library and use it with my macbooks
Is it possible for Apple Time Capsule place iphoto library and use it with my macbook pro & macbook air? How about the simultaneous use? Will I as well open it in my ipad and iphoto?