Getting values from a specific row in a table
hi all, i have a table that has the following data
WITH sec AS
SELECT 111 id, 'XPE' cid, 10 alias, 'TLC' Description, 'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 111 id, 'XPE' cid, 78 alias, 'TLC2' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 111 id, 'XPE' cid, 200 alias, 'TLC' Description, null lvl_1, null lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 111 id, 'XPE' cid, 54 alias, 'TLC3' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 'XPE2' cid, 10 alias, 'PAD' Description, 'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 112 id, 'XPE2' cid, 78 alias, 'PAD2' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 'XPE2' cid, 54 alias, 'TLC3' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 'XPE2' cid, 200 alias, 'PAD' Description, 'SIN' lvl_1, 'CON' lvl_2, ' UIE' lvl_3 FROM dual UNION ALL
SELECT 113 id, 'XPE3' cid, 10 alias, 'PAD5' Description, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
SELECT 113 id, 'XPE3' cid, 200 alias, 'PAD5' Description, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
SELECT 113 id, 'XPE3' cid, 78 alias, 'PAD7' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 113 id, 'XPE3' cid, 54 alias, 'TLE' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual
)i want to write a query that give me this output
ID CID ALIAS DESCRIPTION LVL_1 LVL_2 LVL_3
111 XPE 10 TLC PEYU IES BAN
111 XPE 200 TLC PEYU IES BAN
111 XPE 78 TLC2 SUN BAN3
111 XPE 54 TLC3 SUN5 BAN3
112 XPE2 10 PAD PEYU IES BAN
112 XPE2 200 PAD SIN CON UIE
112 XPE2 78 PAD2 SUN BAN3
112 XPE2 54 TLC3 SUN5 BAN3
113 XPE3 10 PAD5
113 XPE3 200 PAD5
113 XPE3 78 PAD7 SUN BAN3
113 XPE3 54 TLE SUN5 BAN3
this is how the logic works:
as you can see the table has many different set of ids, 111,112,113 and each id has a set of alias
for id 111 and alias 200 the sec table has null values for level 1 and level 2 columns. what i want to do
is that if any of the level1,level2 and level3 columns has null VALUES(FOR aliases=200) then the values should be taking from the ROW(s) with alias=10
in this case alias=200 display peyu and ies for level1 and level2 column. this values were taking from the row with alias=10 and id =111.
level3 stay the same since it is not null
for id 112 and alias =200, none of te level columns has null so the value stay the same as in the table
for id 113 alias 200, all level columns has null so the value should be taking from alias=10 id =113.
in this case the row with alias=10 has also null so both rows 200 and 10 gets display with null values
the other rows with different alias should just be display.
i tried using las_value analytic function but i was not successful. i am using ORACLE 9I and ignore null option in last_value function is not supported
the data in the table is not in any particular order.
can someone help write a query that gives me the output above. thanks
If I understand correct,below solution is corect. :-)
col lvl_2 for a10
WITH sec AS(
SELECT 111 id, 10 alias,'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 111 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 111 id,200 alias,null lvl_1, null lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 111 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 10 alias,'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 112 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 112 id,200 alias,'SIN' lvl_1, 'CON' lvl_2, ' UIE' lvl_3 FROM dual UNION ALL
SELECT 113 id, 10 alias, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
SELECT 113 id,200 alias, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
SELECT 113 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
SELECT 113 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual
select id,alias,
case when alias = 200 and lvl_1 is null
then max(decode(alias,10,lvl_1)) over(partition by id)
else lvl_1 end as lvl_1,
case when alias = 200 and lvl_2 is null
then max(decode(alias,10,lvl_2)) over(partition by id)
else lvl_2 end as lvl_2,
case when alias = 200 and lvl_3 is null
then max(decode(alias,10,lvl_3)) over(partition by id)
else lvl_3 end as lvl_3
from sec
order by id,alias;
ID ALIAS LVL_ LVL_2 LVL_3
111 10 PEYU IES BAN
111 54 SUN5 null BAN3
111 78 SUN null BAN3
111 200 PEYU IES BAN
112 10 PEYU IES BAN
112 54 SUN5 null BAN3
112 78 SUN null BAN3
112 200 SIN CON UIE
113 10 null null null
113 54 SUN5 null BAN3
113 78 SUN null BAN3
113 200 null null null
Similar Messages
-
Af:iterator and getting values from a particular row
Hi,
I am using af:iterator to loop through a resultSet in a VO.
<af:iterator binding="#{backingBeanScope.backing_subscribe.i1}"
value="#{bindings.SubscriptionPublicView1.collectionModel}"
var = "row"
id="i1">
For each iteration, I display a row of data from my VO in a panel box.
Each panel box has a command Link.
Usually, from my backing bean, I do something like this to get an attribute off of a view Iterator.
Row currentRow = getIterator("SubscriptionPublicView1Iterator").getCurrentRow();
int sid = (Integer)currentRow.getAttribute("Sid");
However, in this case, I am always getting the 'sid' from the first record in the collectionModel, and not the 'sid' that corresponds to the commandLink that is selected by the user.
What is the best way to do this when using an af:iterator?
Thanks,
JoelHi,
Timo - as usual - is correct. Using an iterator does not guarantee that selecting a row is set as current in the ADF binding. For this you need to use an action listener on the command component you click on. To get the rowKey of the selected row, you can use a setPropertyListener on the command link that writes the row key of the selected item into memory
<af:setPropertyListener from="#{row.key} to="#{viewScope.key}" type="action"/>
This value then can be looked up in the managed bean to set the row as current in the ADF binding
Frank -
Get the value from a selected row in a table
Hi all,
My table contains a tree structure.
When I select a single row, I need to get the value of a particular column.
I created an action on the leadSelect of the table and gave the following code:
public void onActionleadValue(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionleadValue(ServerEvent)
String strLeadValue = wdContext.nodeAttribute_View_Out().currentAttribute_View_OutElement().getAttributeAsText("<MyModelAttributename>");
wdComponentAPI.getMessageManager().reportSuccess("selected lead value "+strLeadValue);
wdContext.currentContextElement().setLeadselectedvalue(strLeadValue);
//@@end
My Bapi returns me 6 records. and when I click on any row its always pointing to the last record value.
What could be the problem?
Thanks
AnjanaHi Anjana,
Try this.
try
IWDMessageManager msg = wdComponentAPI.getMessageManager();
int leadselect = wdContext.nodeSChild1().getLeadSelection();
for(int i=0;i<wdContext.nodeSChild1().size();i++)
if(leadselect == i)
//Displaying output in diff table
// IPublicTestComp.ITableNodeElement tabelm = wdContext.createTableNodeElement();
// tabelm.setAttribute1(wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute1());
// tabelm.setAttribute2(wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute2());
// tabelm.setAttribute3(wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute3());
// wdContext.nodeTableNode().addElement(tabelm);
String att1 = wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute1();
String att2 = wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute2();
String att3 = wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute3();
msg.reportSuccess("Row ("i") : "att1"====="att2"======"+att3);
} catch (WDDynamicRFCExecuteException e) {
wdComponentAPI.getMessageManager().reportException("Message : "+ e.getMessage(),true);
Regards,
Mithu -
Hi Guys,
FYI, im having a table control with field Plant and Material. I have defaulted the <b>std search help</b> to field <u>Material</u> at the screen painter. Meaning system will call up the search help for Material once i press F4.
Since the search help for field Material is a collective search help, and there is a <u>Plant</u> field available for Material filtering. Thus i may need to get the Plant's value from of same row of the table control to Populate into the Material's search help.
I have already tried to create a new module under the LOOP...ENDLOOP at PAI's flow logic. And try to use parameter id to set the value for plant, purpose is to populate it to Material's search help when i click F4 on material field. The problem is the new module that i coded under LOOP...ENDLOOP will never trigger when i click F4. Because there is NO event to trigger my module.
Other than the above, i tried to code it under POV. But it doesn't work as well, because there is more than 1 record under table control and i can not determine the during runtime which row of F4 for material being click.
Please comment on this above on how to solve the problem.
Thanks in advance.Hi,
You can call standard collective search help [say for Eg:<b>MAT1</b>] through Process on value-request event and set the paramenter id of Plant field before calling the funtion module <b>'HELP_START'</b>.Then we can get the materials specific to the PLANT in the corresponding row of the TABLE CONTROL.
To get which row of the table control is clicked use <b>Get Cursor Line</b> Statement as i mentioned below.
Flow logic:
PROCESS ON VALUE-REQUEST.
FIELD x_marc-matnr MODULE mat_shelp.
Module definition:
MODULE mat_shelp INPUT.
DATA:v_help_info LIKE help_info,n TYPE i,
it_dyselect LIKE TABLE OF dselc WITH HEADER LINE,
it_dyvaltab LIKE TABLE OF dval WITH HEADER LINE.
REFRESH it_dyselect.
it_dyselect-fldname = 'MANDT'.
it_dyselect-dyfldname = 'SY-MANDT'.
APPEND it_dyselect.
it_dyselect-fldname = 'MATNR'.
it_dyselect-dyfldname = 'X_MARC-MATNR'.
APPEND it_dyselect.
v_help_info-call = 'M'.
v_help_info-object = 'F'.
v_help_info-program = sy-repid. "'ZVIG_MOD_TABLE_CONTROL_1'.
v_help_info-dynpro = sy-dynnr. "'9001'.
v_help_info-tabname = 'MARC'.
v_help_info-fieldname = 'MATNR'.
v_help_info-fieldtype = 'CHAR'.
v_help_info-keyword = 'MATNR'.
v_help_info-fieldlng = 18.
v_help_info-fldvalue = ''.
v_help_info-mcobj = 'MAT1'.
v_help_info-spras = 'E'.
v_help_info-menufunct = 'HC'.
v_help_info-title = 'SAP'.
v_help_info-dynprofld = 'X_MARC-MATNR'. <b>----
> Give ur screen field name</b>
v_help_info-tcode = sy-tcode. "'ZTC1'.
v_help_info-pfkey = 'MEN'.
v_help_info-docuid = 'FE'.
v_help_info-pov = 'N'.
v_help_info-curow = '2'.
v_help_info-cucol = '1'.
v_help_info-dynpprog = sy-repid. " ZVIG_MOD_TABLE_CONTROL_1
v_help_info-stepl = '1'.
v_help_info-selectart = 'A'.
GET CURSOR LINE n.
READ TABLE it_marc INTO x_marc INDEX n.
SET PARAMETER ID 'WRK' FIELD X_MARC-WERKS .
CALL FUNCTION 'HELP_START'
EXPORTING
help_infos = v_help_info
TABLES
dynpselect = it_dyselect
dynpvaluetab = it_dyvaltab .
ENDMODULE. " mat_shelp INPUT -
Get value from Table/Recordset Cell into a JSP variable
Can anyone please help with this ?...
I need to get a cell value from a selected row of a table into a variable to pass to a java bean.
1 - The dynamic table is populated by a recordset named "rs" and has a submit button for each row .
2 - The user clicks on the corresponding button to select the row.
3 - The recordset retrieved the ID for that row in the query, but does not display it in the table.
I have tried :
<% String ID = rs.getString("bookid");%>
<% Library.bookConfirm(ID);%>
But this fails saying that it "cannot resolve variable rs..."
Yet the recordset populates correctly and its name is "rs"
Is there another way to do this perhaps ?... ie: put the id in a column of the table and get the cell value ?...
What would be the syntax to get the ID cell value of that selected row on the button click ?...
Your feed back would be greatly appreciated.
Thank you.Create a new rs
ResultSet rs1 = statement.executeQuery(query);
and use getstring to access the individual cell. -
SSRS 2012
Dataset (40 columns) including the first 3 rows for Report layout configuration (eg: the <second> row specifies the column background color).
Starting from the 4th row, the dataset contains data to be displayed.
I would like to change the background color of the ColumnHeader/Column based on the value in the same column in the <second> row.
How can I accomplish the this requirement? (this must be applied for all the columns)
ThanksHi Fasttrck2,
Per my understanding that you want to specify the background color of all the columns/column header based on the value in one special column of the special row, right?
I have tested on my local environment and you can add expression to condition show the background color in the columns properties or the column header properties.
Details information below for your reference:
Specify the background color in the Column header: you can select the entire column header row and in the properties add expression in the Background color :
If you want to specify the background color for the entire column, you can select the entire column and add the expression, repeat to add background color for other columns.
If you want to specify the background color based on the value in the specific columns and row, you can create an hidden parameter to get the list of values from the specific column, specify the Available values and default values by select "Get
values from a query", finally using the expression as below to get the specific value you want:
Expression(Backgroud Color):
=IIF(Parameters!Para.Value(1)="1221","red","yellow")
If your problem still exists, please try to provide some smaple data of the report and also the snapshot of the report structure to help us more effective to provide an solution.
Any problem, please feel free to ask.
Regards
Vicky Liu
If you have any feedback on our support, please click
here.
Vicky Liu
TechNet Community Support -
Hi,
I am new to OAF, I am trying to get the value from the table in order to make validation. I have the following PG:
SearchResultsTableRN
itemRow
DetailsCell
DetailsTableLayout
ShortDescRow
ShortDescCell
ShortDesc
LongDescRow
LongDescCell
LongDesc
AttributesRow
AttributesCell
AttributesTableLayout
Attributes1Row
Attribute11Cell
ect...
Can anyone help me please in how to go into the table --> row --> column to retrieve the value from a specific column?
If their is a document or example that can help I will appreciate it. Since I tried searching in devguide and didn't find any results.
Note: I am extending the controller and reached till the following code:
public void processFormRequest(OAPageContext oapageContext, OAWebBean webBean){
super.processFormRequest(oapageContext, webBean);
String event = oapageContext.getParameter("ShortDescRow");
OATableBean advtable = (OATableBean)webBean.findChildRecursive("SearchResultsTableRN");
OARowBean rowtbl = (OARowBean)advtable.findChildRecursive("DetailsCell");
String message = "test:"+event+"|"+advtable+"|"+"|"+"|"+"|";
throw new OAException(message, OAException.INFORMATION);
Thanks and Regards
PatrickPatrick,
My first advice would be go through OAF guide and do tutorial examples, for such basic details.
If ur talking about tablelayout region
u can use pageContext.getParameter(<Item id of UIX bean whose value u want>);
If you are talking about table
You can Iterate through the VO based on primary key ...on which the table is based, and retrive the corresponding Vo attribute value.
--Mukul -
From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?
Hi,
Use NVL or COALESCE:
NVL (col_a, col_b)
Returns col_a if col_a is not NULL; otherwise, it returns col_b.
Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Getting values from a datagrid to an ArrayCollection
Hi, I have a drag and dropable datagrid. I fill it with rows of data from another datagrid. Finally, my application demands savings the data from the datagrid into an array collection along with the index of each row. How do i get values from a datagrid into an arrayCollection variable? Please help me..!
Whatever is dropped into the DataGrid automatically goes into its dataProvider property, typically an ArrayCollection. Just access the data grid's dataProvider property to see the values.
-
How can I get values from listbox?
Hi all,
I need to get price values from Price List (Inventory -> Item Master Data screen). It's important to get values from field 'Price' BEFORE item will be added/updated.
How can I get values from Pricelist listbox?
Thanks for any suggestions or short sample code.
Best regards,
AndyHi Andy
Here is som sample code that will get the description of the price list and also the price that is displaying at the time. The item master must be open for this snippet of code
Public Sub GetItemPriceFromOpenWindow()
'this is assuming item master is open
Dim oEdit As SAPbouiCOM.EditText
oEdit = SBO_Application.Forms.GetForm("150", 1).Items.Item("34").Specific
SBO_Application.MessageBox(oEdit.Value)
Dim oCmb As SAPbouiCOM.ComboBox
oCmb = SBO_Application.Forms.GetForm("150", 1).Items.Item("24").Specific
SBO_Application.MessageBox(oCmb.Selected.Description)
End Sub
Hope it helps -
How to get values from a table(in jsp) for validation using javascript.
hi,
this is praveen,pls tell me the procedure to get values from a table(in jsp) for validation using javascript.
thank you in advance.Yes i did try the same ..
BEGIN
select PROD_tYPE into :P185_OFF_CITY from
magcrm_setup where atype = 'CITY' ;
:p185_OFF_CITY := 'XXX';
insert into mtest values ('inside foolter');
END;
When i checked the mtest table it shos me the row inserted...
inside foolter .. Now this means everything did get execute properly
But still the vallue of off_city is null or emtpy...
i check the filed and still its empty..
while mtest had those records..seems like some process is cleaining the values...but cant see such process...
a bit confused..here..I tried on Load after footer...
tried chaning the squence number of process ..but still it doesnt help
some how the session variables gets changed...and it is changed to empty
Edited by: pauljohny on Jan 3, 2012 2:01 AM
Edited by: pauljohny on Jan 3, 2012 2:03 AM -
I need some syntax help with reading some values from a selected row in an Access form.
My goal: to extract the data from 4 fields in a datasheet row and place them in another form.
My problem: I can only get the field values from the first row of the datasheet.
I have tried using the Form_Click event as the location for the code I've tried. This seems to be the right place, but apparently referring to the desired fields by their names with Me. in front just references the first record in the datasheet, not
the one I've selected.
Should I just read the source form's recordset using the Currentrecord value somehow? I could use some direction on that.
Thank you.
Marj WeirIt's generally considered good forum etiquette to post back a description of the solution which you've reached.
The normal control for a multi-valued field is a combo box rather than a text box, but unless it is necessary for you to use a multi-valued field, i.e. your database is interfacing with SharePoint in the very limited context in which this feature is necessary,
I'd advise that you model the many-to-many relationship type in the time-honoured way by means of a table which resolves the relationship type into two one-to-many relationship types, and use a subform to show the data. You can alternatively use a multi-select
list box or a text box which shows a value list. You'll find examples of all three methods in StudentCourses.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
Ken Sheridan, Stafford, England -
Get value from Direct Database Request
Hi Experts,
I have report based on Direct Database Request which returns one row. I have to use value from this report in other one.
So, I have to get value from query and set into some variable but I don't know there is any way to do it.
Thanks in advance for any suggestion
Regards,
EskThank you for your reply, but I don't want to use variable in Direct Database Request in clausal 'WHERE' or 'IN'.
I want value which returns query. For example if my Direct Database Request is : 'Select ID from table1', then
I wand this 'ID' in variable to use it in other report.
regards
Esk
Edited by: Eskarina on 21-may-2012 2:16 -
How to get values from a stored package variable of type record ?
Sir,
In my JClient form, I need to get values from a database stored package variable of type record. And the values are retained in the JClient form for the whole session. The values are copied only once when the form is started.
What is the best way to do that ?
Thanks
StephenStephen,
not sure what your model is, but if it is Business Components, I think I would expose the properties as a client method on the application module. This way all JClient panels and frames will have access to it. You could use a HashMap to store the data in teh app module.
If JDBC supports the record type, then you should be able to call it via a prepared SQL statement. If not, you may consider writing a PLSQL accessor to your stored procedure that returns something that can be handled.
Steve Muench provides the following examples on his blog page
http://otn.oracle.com/products/jdev/tips/muench/stprocnondbblock/PassUserEnteredValuesToStoredProc.zip
http://otn.oracle.com/products/jdev/tips/muench/multilevelstproc/MultilevelStoredProcExample.zip
Frank -
POPUP FM to get values from a table control?
I know about the FM POPUP_GET_VALUES to get one or more values from a popup dialog box. I would like to find a similar FM that allows getting values from a table control or something that allows entry of multiple lines of values. Is there such a thing, or do I need to write my own?
it depends on what values you want to enter, better write your own to have a control on the function.
Maybe you are looking for
-
Satellite A210 1AP - The display is not turning on
I had a problem about a mounth ago with my Toshiba Satellite A210-1AP, just once the display did not turn on. Computer was working, all lights were on. That light that shows reading from HDD was blinking, working as normal, but with display still tur
-
Problems with Plan Change - Needs Immediate Result
Hello, I have been a long time Verizon Wireless customer. I have two lines, one of which was assigned to a tablet with a 1gb plan. I maintained this line for the upgrade since my other line has unlimited data. I recently upgraded to the Note 3, an
-
Youtube reply button in comment section does not work
As of today the "reply" button in the comment section on any youtube video has stopped working, Usually it brings up an input field when clicked, but now I get nothing except a blue glow around the button [http://i259.photobucket.com/albums/hh299/Vir
-
Using Lightroom in Conjunction with Elements
I currently use Elements 10 (and love it) and am considering purchasing Lightroom 5. However it seems like the lines between some of the Adobe products is getting blurred. Photoshop Elements seems to be getting more of the capabilities of Photoshop
-
Condition type value table ????
I want the value of the Condition type of taxes in the Purchase Order When we open the PO , Click on Invoice and then on Taxes, the screen shows Condition types and there values. From which table i can get these values on the basis of the Purchase Or