get a row in a table 2D-TestStand
What is the syntax to get a row in a table 2D-TestStand
NEITHER told I have to recursively or outside.
Here is my approach to get a rank of recursively in TS.
PreExpression:
Parameters.Row = {}, Locals.i = 0, / / initialize variable
GetArrayBounds (Parameters.Array2D, Locals.loBounds, Locals.hiBounds),
Locals.columnQty = 1 + Val (Mid (Locals.hiBounds, Find (Locals.hiBounds, "]") + 2, Len (Locals.hiBounds) - 3 - Find (Locals.hiBounds, "]")));
Locals.WhileExpr = Locals.i «»< locals.columnqty",="" set="" condition="">
Locals.DoExpr = "Parameters.row += {Parameters.Array2D [Parameters.rowIndex] [Locals.i]} ++ Locals.i" / / defines the expression to run recursively
The Expression:
Evaluate (locals. RcrExpr)
where Locals.RcrExpr is:
Evaluate (locals. WhileExpr)? (Evaluate (Locals.DoExpr), Evaluate (Locals.RcrExpr)):
Tags: NI Software
Similar Questions
-
How to get multiple rows in the table is displayed on the form
I am looking for a way to get more table rows that appear on the form. I created a table with a header and a line with the add-in and remove button option. I like how the sample purchase order form has it setup in the designer it shows one line and it appears on the form so the table has three rows to start with. How do I do that? I looked at the code on the sample and I couldn't find it anywhere. Please help, thanks.
Hello
I have an example here in the construction of a dynamic array markets.
http://www.assuredynamics.com/index.php/category/portfolio/building-dynamic-tables/
You must select the line and then go to object > Binding palette and set it to repeat. You can set the minimum and initial number to what you want.
The form should be saved in a dynamic form of XML in the Save as dialog box.
Also the page must be set to Flowed, so that as the table grows, push another object down. In addition, you need to configure the paging settings so that the flow of the page as the number of lines is superior to a single page.
Give a start and if you need more help,
Niall
-
Get the values of default table row when the page loads
Hello
I am running JDev 11.1.1.7. We have a page that contains two tables in a relationship of the master / detail of nickname. We can do a real master ADF / detail with view items related because the query for the 2nd table is complex and works best when queries with binding settings. The View object for the 2nd table has a request with 2 link params as it can get in the first table. Thus, when a line is selected in the first table we want to execute ExecuteWithParams on the object from view of the table 2. We do it in the Bean managed for the page in a method that is the selection to the first table listener. It works fine except when the page initially loads, the first line is selected by default. When the default value is selected the selection listener is not triggered.
I've seen the suggestion of not having a line selected by default when the page loads by removing the value selectedRowKeys on the table. However, we do not want that the 1st row of the table secondary master to be selected by default and we as the table of detail to show the correct corresponding lines.
Steve
Steve,
Not really sure when you say that the 2nd table is complex and may not use the master detail. If the settings link in the parent table, you can set the ViewLink accordingly and it should work, right?
In any case, if you're after the execution of methods on the loading of the page, you will find the links below.
If it's a working group, you can add a methodCall as activity by default and UTF, you can use phase listener (if listener server does not).
https://blogs.Oracle.com/aramamoo/entry/an_epic_question_how_to
It will be useful.
See you soon
AJ
-
Cannot get rid of the gaps between the rows in the table with the basic HTML in DW cc 2015
Hi gang
I haven't used html in ages and doing something basic without css... but for some reason any I get these gaps between the rows in the table, no cause I do.
what I am doing wrong?
< ! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 / / IN" "http://www.w3.org/TR/html4/strict.dtd" > ""
< html >
< head >
< meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 ">"
< title > Untitled Document < /title >
< / head >
< body >
< table width = "560" >
< /table >
< table width = "560" border = "0" align = "center" cellpadding = "0" cellspacing = "0" >
< tbody >
< b >
< td colspan = "3" > < img src = "images/AAA - ADE_01.jpg" width = "560" > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_02.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_03.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_04.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_05.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_06.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_07.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_05.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_06.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_07.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_08.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_09.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_10.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_11.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_12.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_13.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_14.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_15.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_16.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_17.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_18.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_19.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_20.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_21.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_22.jpg" height = "267" / > < table >
< /tr >
< / tbody >
< /table >
< / body >
< / html >
Add this in the
section of your pagetable {
border-collapse: collapse;
}
img {
vertical-align: middle;
}
-
How do I get the selected row in the table (FacesCtrlHierBinding).
I am trying to get the data of the selected row in the table:
RowBinding () (FacesCtrlHierBinding) tab.getSelectedRow = FacesCtrlHierBinding;
Line rw = rowBinding.getRow ();
But for oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding be found since my 11 JDev to import.
What is a good package for FacesCtrlHierBinding?Hello
This is the code I use to get the selected rows in a rich table of adf:public void deleteMarkedRows() { RichTable table = this.getImportTable(); //get table bound to UI Table RowKeySet rowKeys = table.getSelectedRowKeys(); Iterator selection = table.getSelectedRowKeys().iterator(); while (selection.hasNext()) { Object key = selection.next(); table.setRowKey(key); Object o = table.getRowData(); JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding) o; Row row = rowData.getRow(); row.remove(); } //prepare table to show changes table.setFirst(0); RequestContext.getCurrentInstance().addPartialTarget(table); }
Hope this helps
Timo
-
How to get verified data rows in a table?
Hai
To display a check box my table on page jspx, I created a transitional attribute, the salt and the type select as Boolean.Then when I drag and drop my page jspx viewObject. The table cantain id, name, designation, salary, salt
Then I deleted the link in the column of salt and drop a checkbox select Boolean to this column. Then in the property inspector, I bind the value # {row.sel} for box...
Suppose that there are 5 lines in my table... I checked only 3 of them. When I pressed a button, the corresponding to the id must be extracted and checked lines in the table and I want to show more details corresponding to this id of in another table in the jspx page. I use jdev 11Hello
So if I find correct this time, you do not want to select the lines by clicking on the row in the table but rather by selecting the check box that you created. Fix? Sorry, previous confusion is because of me "thinking in Trinidad. Anyway, you can then set the rowSelection of the table as zero, as you select the line in this way. Try the code below.
public String doSomething() { List
rows = getAllRows(getTable1()); for (Row row : rows) { if ((Boolean)row.getAttribute("sel")) { // Check if it's true which (should) indicate the checkbox as being selected System.out.println(row.getAttribute("id")); // Your selected id based on the checkbox you selected. } } } public List
getAllRows(RichTable table) { List
rowList = new ArrayList
(); Row row = null; FacesCtrlHierNodeBinding rwData = null; int total = table.getRowCount(); for (int i = 0; i < total; i++) { rwData = (FacesCtrlHierNodeBinding)table.getRowData(i); if (rwData != null) { row = rwData.getRow(); rowList.add(row); } } return rowList; }
A few points to note. The getAllRows method loops through the entire VO. So if you have 10,000 rows, shut up 10,000 times. If you are dealing with large records or who want to optimize the code, you will need to loop through the "displayed" only lines. To do this, you need to change the code.
Kind regards
Amélie Chan -
Best way to update the individual rows of a Table?
I took a quick glance at a few examples, but did not get a clarification on this. I am looking to have something close to a listbox control or the table to where I can update just one column of values to line a 1 time per second pace. I'm looking to display our acquisition of data values in a table or a listbox control. The single list box seemed to work well for that, but I couldn't use the row headers to list the names of channel beside the channel values. I thought to link the values of cursor in two areas of list to do this, but did not find any info on it for the single list box.
I have a few questions:
(1) I have a 1 d table to where I want to use this data to constantly update the first column (with a multitude of lines) of a table. I'm looking for the best route to not take too much time for treatment by doing this.
What is the best way to update the individual rows of a table? Invoke the node "Value of the cell value"... or is there another method?
(2) why is that, after each iteration else, row values are deleted?
Also, for adding additional channels originally arrray... it is better to use the 'Array' subset then the function "Construct the table" or function "Subset of the table" and "insert table"?
See the attached example.
Thank you.
Jeff· Þ· Bohrer says:
(2) why is that, after each iteration else, row values are deleted?
Classic race condition. dump the loop and node-p and just wire the 2D table on the terminal Board. !
I don't see the race condition. What I see is the table once the last element has been written for it all run the oil. I saw looked it with point culminating performance on.
But I agree entirely with writing to the Terminal. It is a 1 d array, so you will need to use an array of generation and convert a 2D array in order so that he could write correctly.
-
Hide columns in Table B, based on values LOV in another row of the table:
Hello
Jdev 12.2.1.0
I have two tables A and B and I hide columns b based on the value of row of table A LOV. For example, I have a line in A table that has a column with the x, y, z values lov. Now, if I select the row in the table has and change the LOV to x, I had to hide some of the columns in the table (B) is there a way to get this feature? Any help would be appreciated.
Thank you
Assume:
1 table a call "DepartmentId" column this column has LOV.
B 2-table a column "ColumnInB" this column will be visible depending on the value of "DepartmentId".
Try to do the following:
1 - from data controls, drag "DepartmentId" attribute and drop it on the page as inputText then together make this inputText to false (you can remove it, but don't forget the corresponding binding in pageDef. not deleted).
2. copy the value of the inputText which will be as "#{bindings." DepartmentId.inputValue}"and go to the"ColumnInB"column and visible property beyond the copied value.
3 - the ColumnInB visible will be the condition as:
4-set DepartmentId autoSubmit = 'true '.
5-set table partialTriggers table B has id and id of DepartmentId LOV
-
Hi master,
I have a requirement. During the passage of a table, I need to get the number of rows in this table. Sometimes, when I spend 2 or more table names, I need to get the same count of result of lines. I got the below function. but it shows all the rows in the table. I want pariticular tabels only. How I can I get it.
Select table_name, num_rows from all_tables where table_name in ('EMP', 'Department'); I tried. I need to a procedure or function. who will pass the name of the table as a parameter and 1 or more than the name of a table if I pass, I need to display information from table name and number of lines.
CREATE OR REPLACE
TYPE t1_obj AS OBJECT)
table-name VARCHAR2 (30),
CNT NUMBER
)
/
CREATE OR REPLACE
TYPE t1_obj_tbl AS THE t1_obj TABLE
/
CREATE OR REPLACE
FUNCTION (f1)
p_schema_name VARCHAR2
)
RETURN t1_obj_tbl
PIPELINED
IS
v_retval t1_obj: = t1_obj (null, null);
BEGIN
FOR v_rec IN (SELECT table_name FROM dba_tables where owner = upper (p_schema_name) and nvl (iot_type, 'X')! = "IOT_OVERFLOW") LOOP
v_retval.table_name: = v_rec.table_name;
RUN IMMEDIATELY "SELECT COUNT (*) FROM" | p_schema_name | '.' || v_rec.table_name
IN v_retval.cnt;
PIPE ROW (v_retval);
END LOOP;
RETURN;
END;
Select * from table (f1 ('scott'));
The above function returns information from the table in SCOTT scheama. I need only perticular table info.
Please notify.
AR.
Hi Sven,
Front end people ask me the requirement. They wanted a proc or function as I want.
Please help me.
Concerning
AR
-
I have a table of the adf, I added a column that contains a button that I created, when I click it must remove this row in the table, but it is not, please help
I don't understand. You use vo and eo for you to use business components.
Again, this kind of code call in trouble.
You must post the changes to make them visible to the eo find vo. You must then run the query for the changes in the business layer strips then you must update the iterator he table is based on.
In your code I see that happen, hooch maybe because it is more often than not formatted and undocumented.
My advice is to do a small test case that you can manage with easy sql. Once you get it to run transfer you the results to the actual application.
Timo
-
Rows in the table LT until merger of all workspaces
Database 11.2.0.4
In our environment, we ran a few important updates in the workspaces and then merged these live workspaces. Up to 25% of the data has been updated in those workspaces. When these update batch workspaces have been created, previous workspaces exist who are not yet ready for the merger.
I noticed that the underlying tables of the LT now have about 25% more lines than the live view. We have now discovered that dbms_wm.refreshWorkspace works really poor. This statement is used to take seconds or minutes to the maximum, but can now take half an hour or more.
We recorded a support with Oracle request and provided details of the plan to see if we can get some resolution/advice explaining.
In the meantime, I have a question for the forum help my understanding of the works of the Manager of the workspace.
In the example below, I have table "wm_test_table", "test_workspace1" and "test_workspace2". In "test_workspace1", I update all rows in the table - the table LT now has 2 rows for each record. I merge 'test_workspace1' live and LT still has 2 rows for each record. The other lines are not removed until "test_workspace2" is merged and removed.
SQL> -- Create a test table SQL> create table wm_test_table ( 2 id integer primary key, 3 name varchar2(100)); Table created. SQL> -- Insert 1,000 rows SQL> insert into wm_test_table ( 2 select rownum, 'before' 3 from dual 4 connect by level <= 1000); 1000 rows created. SQL> commit; Commit complete. SQL> -- Version enable it SQL> execute dbms_wm.enableVersioning('wm_test_table'); PL/SQL procedure successfully completed. SQL> -- Create two workspaces SQL> execute dbms_wm.createWorkspace('test_workspace1'); PL/SQL procedure successfully completed. SQL> execute dbms_wm.createWorkspace('test_workspace2'); PL/SQL procedure successfully completed. SQL> -- Go to test_workspace1 and update all the rows SQL> execute dbms_wm.goToWorkspace('test_workspace1'); PL/SQL procedure successfully completed. SQL> update wm_test_table set name = 'after'; 1000 rows updated. SQL> commit; Commit complete. SQL> -- Check how many rows in wm_test_table_lt - we expect 2,000 as we haven't merged yet SQL> select count(*) from wm_test_table_lt; COUNT(*) ---------- 2000 SQL> -- Merge and remove test_workspace1 SQL> execute dbms_wm.goToWorkspace('LIVE'); PL/SQL procedure successfully completed. SQL> execute dbms_wm.mergeWorkspace('test_workspace1', remove_workspace=>true); PL/SQL procedure successfully completed. SQL> -- Check how many rows in wm_test_table_lt SQL> -- I'd hope there'd only be 1,000 but there is 2,000 SQL> select count(*) from wm_test_table_lt; COUNT(*) ---------- 2000 SQL> -- Let's see if compressWorkspace will get rid of them SQL> execute dbms_wm.compressWorkspace( - > workspace => 'LIVE', - > auto_commit => true, - > remove_latest_deleted_rows => true); PL/SQL procedure successfully completed. SQL> -- They're still there SQL> select count(*) from wm_test_table_lt; COUNT(*) ---------- 2000 SQL> -- Now merge test_workspace2 SQL> execute dbms_wm.mergeWorkspace('test_workspace2', remove_workspace=>true); PL/SQL procedure successfully completed. SQL> -- and the additional 1,000 rows are removed SQL> select count(*) from wm_test_table_lt; COUNT(*) ---------- 1000
Is it possible to safely remove the extra lines in LT without waiting until we merged the workspaces that existed before the update batch has been done? I hope that it will so improve the performance of refreshWorkspace.
I thought that something like this can do, but it does not remove the other ranks, is:
execute dbms_wm.PurgeTable( table_id => 'test.wm_test_table', archive_table => null, where_clause => 'id not in (select id from test.wm_test_table)', instant=>null, workspace => 'LIVE', purgeAfter => false);
This question is similar to
Lines left in the table LT after removal of the direct workspace and the removal of all workspaces
and
but I'm still not sure.
Thank you
John
Hello
This behavior is expected and it is due to the test_workspace2 workspace. A compression operation will not allow compressed range to include a backup implicit point that is created for a child workspace. This is done to preserve the integrity of this workspace. The initial 1000 lines are all lines that are visible from test_workspace2. Removal of these lines would leave test_workspace2 will 0 lines in there. Lines 1000 updates are the lines that do not appear on LIVE. So, given that the two sets of lines are needed, none of the lines can be deleted physically. A compression operation will never change the view of data for any workspace. It only removes the unnecessary records. The two options in order to be able to compress these lines is to either delete (as you did) or refresh test_workspace2. The refresh operation would move the implicit savepoint for the workspace to a version that isn't after all 2000 lines in the table _LT and allow the dressing to remove first half of them because they are no longer needed by any child workspace.
With respect to the performance of RefreshWorkspace, I would need to see a trace of the transaction file. But who should rather get through the SR you filed.
Kind regards
Ben
-
How to get the values of the table of the ADF to bean class?
Hi all
My 11.1.1.6 Jdev
Here I do not use BC ADF in my project. I'll put values in the ADF table with bean.
In the table, I put a checkbox. When I selected (Checkbox) a few rows in table and submit. In the submit method, I want to get all the values of line checkbox selected in my bean class.
How can I get the values. ???
Here my table UI code
< af:table var = "row" rowBandingInterval = "0" id = "t1" value = "#{pageFlowScope.BinderSolutionsBean.uiBinderProperties} '"
styleClass = "AFStretchWidth" emptyText = "no record found".
Binding = "#{pageFlowScope.BinderSolutionsBean.binderTree}" >
< af:column sortable = "false" headerText = "Script ID" id = 'c4' >
< af:panelGroupLayout id = "pgl4" >
< af:selectBooleanCheckbox id = 'sbc1' > < / af:selectBooleanCheckbox >
< af:spacer width = "5" / >
< af:outputText value = "#{row.scenarioId}" id = "ot5" / > "
< / af:panelGroupLayout >
< / af:column >
< af:column sortable = "false" headerText = "Quote ID" id = "c1" >
< af:outputText value = "#{row.quoteId}" id = "ot4" / > "
< / af:column >
< af:column sortable = "false" headerText = "NASP ID" id = "c2" >
< af:outputText value = "#{row.naspId}" id = "ot2" / > "
< / af:column >
< af:column sortable = "false" headerText = "GCH ID" id = 'c3' >
< af:outputText value = "#{row.gchId}" id = "ot3" / > "
< / af:column >
< af:column id = "c6" headerText = "Term" >
< af:outputText value = "#{row.term}" id = "ot9" / > "
< / af:column >
< af:column sortable = "false" headerText = "Status" id = "c5" >
< af:outputText value = "#{row.status}" id = "ot6" / > "
< / af:column >
< / af:table >
follow some above recommendation such as the creation of additional attribute. You will also need the key in your collection, while making the data for your chart.
You must write a custom selectionListener. On valueChangeEvent of box, get the key of a line and add the line at the bean.
Maybe it's little help for you
-
ADF: Double in taskflow Page Navigation click on the row in the table on the page .jsff
Hi all
My 11.1.1.7 Jdev.
I have a taskflow with two fragments (.jsff) pages. On the first page, I have a table when I double click on the row in the table that I want to go to the next page.
I tried to call java script but I do not understand. How can I get it?
handleNavigation is the only thing that you should not use in the adf. Read 'How to navigate in the stubborn workflow' in this http://www.oracle.com/technetwork/developer-tools/adf/learnmore/nov2010-otn-harvest-190744.pdf.
Timo
-
cannot access the rows of a table not nested element
What Miss me? I'm under Oracle 12 c (12.1.0.1.0)
CREATE TYPE dim_O AS OBJECT )dimension_id number
label_en varchar2()300( )
);
CREATE TYPE dim_T AS TABLE OF dim_O;
DECLARE
dims_t dim_T
START
SELECT CAST(MULTISET( ))
SELECT DIMENSION_ID LABEL_EN
DE DIMENSIONTABLE -actual physical table in oracle
OÙ DIMENSION_ID IN (3001 3002 3003()
) AS dim_T) "dim_rec"
BY dims_t
DE DOUBLE;
FOR I IN dims_t. FIRST... dims_t. LAST LOOP
DBMS_OUTPUT. Put_line() dims_t() I). dimension_id);
END LOOP;
-exit from the loop above is
-3001
-3002
-3003
-The following statement fails: cannot access the rows of a table not nested element
UPDATE TABLE ( SELECT dimension_id FROM TABLE (dims_t) ( )
Dimension_id SET = WHERE = dimension_id 3004 3003
-The following statement fails: cannot access the rows of a table not nested element
UPDATE TABLE ( SELECT dimension_id FROM TABLE (CAST (dims_t in dim_T () ) ( )
Dimension_id SET = WHERE = dimension_id 3004 3003
END;
I'm trying to understand this example very simple, but to no avail.
Can someone tell me why I get this error?
Thank you all in advance for your time.
Marc
What Miss me? I'm under Oracle 12 c (12.1.0.1.0)
CREATE TYPE dim_O () AS OBJECTnumber of dimension_id
label_en varchar2 (300)
);
CREATE TYPE dim_T AS TABLE OF dim_O;
DECLARE
dims_t dim_T;
BEGIN
SELECT CAST (TYPE MULTISET)
SELECT DIMENSION_ID, LABEL_EN
OF DIMENSIONTABLE -actual physical table in oracle
WHERE DIMENSION_ID IN (3001,3002,3003)
() AS dim_T) 'dim_rec '.
IN dims_t
FROM DUAL;
I'm IN dims_t.FIRST... dims_t.Last LOOP
DBMS_OUTPUT. Put_line(dims_t (i) .dimension_id);
END LOOP;
-exit from the loop above is
-3001
-3002
-3003
-The following statement fails: cannot access the rows of a table not nested element
UPDATE TABLE (SELECT dimension_id FROM TABLE (dims_t))
SET dimension_id = dimension_id = 3003 3004 WHERE;
-The following statement fails: cannot access the rows of a table not nested element
UPDATE TABLE (SELECT dimension_id FROM TABLE (CAST (dims_t as dim_T)))
SET dimension_id = dimension_id = 3003 3004 WHERE;
END;
I'm trying to understand this example very simple, but to no avail.
Can someone tell me why I get this error?
You get it because dims_t is an array of OBJECTS - not a table of scalars. But your SELECT statement returns scalar.
There IS NO such object, named "dimension_id"; It is an ATTRIBUTE of the object DIM_O. DIMENSION_ID is a SCALAR which, as says the exception, is a "No nested table element; If you cannot select/Update lines of it.
What you do is equivalent to the following:
DECLARE
dims_t dim_T;
number of dim_id;
dim_o design;
BEGIN
Design: = dim_o (3, 'ghi');
SELECT DIM_O (DIM_ID, LABEL) BULK COLLECT INTO table DIMS_T (d_o);
end;
/
ORA-06550: line 7, column 59:
PL/SQL: ORA-22905: cannot access the rows of a table not nested element
ORA-06550: line 7, column 1:
PL/SQL: SQL statement ignored
This SELECTION is trying to design it as a table when it's a SCALAR - so the same exception you get.
-
Get elements of the other table
Hi all
I have a table with a few lines like:
create the table myTABLE
(number of myID,
VARCHAR2 (20) itemID.
fieldA varchar2 (10),
fieldB varchar2 (10),
fieldC varchar2 (10)
);
I have a query that contains the itemID as
Select c.myID, c.itemID, c.sourceA, a.sourceDescA, b.sourceDescB
Cuttable c
Join the tableA an a.myID on c.myID =
Join tableB b on b.myID = c.myID and b.sourceID = a.sourceID
What is the effective way for the description of the elements of the query based on itemID from myTable? Keep the same number of rows in myTABLE
myTABLE.myID, myTABLE.itemID, myTABLE.fieldA, myTABLE.fieldB, myTABLE.fieldC, query.sourceA, query.sourceDescA, query.sourceDescB
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0
Thank you
Hello
user9542267 wrote:
...
How can I choose the first itemID if I have two itemID with a different description than my new sample data.
Remember, the rows of a table are not in any particular order. If you talk about the 'first' line, you must clearly indicate what means 'first' to you.
Do you really need to take the first itemID? And the problem is really two itemIDs with a different description. Don't expect different itemIDs for different descriptions?
It seems that the problem occurs when 1 (not 2) itemID has different descriptions, and you want to choose only 1 line by itemID, regardless if this itemID is 1st, 2nd 3rd or Nth itemID. For example, in the sample data you posted in response #8, there are 2 distinct values for source (and sourceDescB and sourceDescC, but the problem would be the same if any 1 of them were only different) who have itemID = '23'. I don't know if consider you "23" to be the itemID 1st or 2nd, but I don't think it really matters. It seems to me that the problem would be the same if "24 K" was considered the first itemID or if 'F25' was.
Here's a way to ensure that you get only the 'first' line each Itemid of sourceTABLE, where "first" means in order by sourceID:
WITH source_with_r_num AS
(
SELECT itemID, source, sourceDescA, sourceDescB
ROW_NUMBER () OVER (PARTITION BY itemID
ORDER BY ID source
) AS r_num
FROM sourceTABLE
)
SELECT m.myID, m.itemID, m.fieldA, m.fieldB, m.fieldC
s.sourceA, s.sourceDescA, s.sourceDescB
MYTABLE m
JOIN source_with_r_num s ON s.itemID = m.itemID
WHERE r_num = 1
ORDER BY m.myID
;
Results of the sample data in the #8 response:
MYID ITEMID FIELDA, FIELDB, FIELDC SOURCE SOURCEDESC SOURCEDESC
----- -------- ------ ------ ------ ---------- ---------- ----------
1 23 an ABC AB 23 Source 23 Desc has 23 B Desc
2 24K B BC BCD 24K Source 24K Desc has 24K Desc B
3 F25 C CD CRC Source Desc F25 F25 F25 Desc B
If there is a tie for the 'first' line for a given itemID, ROW_NUMBER arbitrarily call one of them 'first '. If this isn't what you want (that is, if it is important which one is selected), you can add playoff expressions in the ORDER BY clause analytical ROW_NUMBER.
Maybe you are looking for
-
Failed to start after the active partition changed by mistake
By mistake partition active of my hp laptop pavilion has been changed to recovery disc (D) and WINDOWS DOES NOT START. I can access prompt f11 (hp system recovery) when starting. How to change the partition active (command prompt in recovery when you
-
is there a simple guide on how to use Windows Media Player to play MP3 files on a Web site
I'm designing a simple website to a friend. They are singers and want 3 or 4 songs sample of people to listen to on the site. What is the easiest way to do this (I m not technical, it should be easy to understand) Idea is that the user accesses the p
-
lost broadband on my HP Pavilion 15
Hello, my HP Pavilion 15 Notebook PC (ENERGY STAR) works very well until yesterday when I lost my broadband connection. It is said there is a problem with my network card or modem, but it works on a wi - fi connection (connected via my modem) and my
-
My paswword is not working and now my computer won't let me?
How can I get my computer re-out, so I can access it?
-
How to get currently displayed a phone app phone number?
City previous forums: nkarasev Messages: 93Join date: Apr, 2007 How to get currently displayed a phone app phone number? Posted the: July 31, 2008 12:06 AM If there is a way to get the phone number of the user currently entered the dial phone app B