VORowImpl problem - comparing two ROW[] lists
Hi Everyone,
I have a huge proble right now, I'm trying to compare two VO list with the same values, this is because one it's attached to an advancedtable in the xml page wich the user can change some values, and the other one is from the values of the table but from the DB, the reason is to made a validation to compare the original values from the DB with the list from the tabla and update only the rows that the users made changes in their values, here's my code for a better explain of what I'm doing:
public void saveChanges(){
OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getDBTransaction();
Row[] rows1 = getAppVO1().getAllRowsInRange();
Row[] rows2 = getDBVO1().getAllRowsInRange();
for(int i = 0; i < rows1.length; i++){
int j = i;
//Colections to compare
//r1: colection from the app
//r2: colection from BD
AppVORowImpl r1 = (AppVORowImpl) rows1;
DBVORowImpl r2 = (DBVORowImpl) rows2[j]; //<--- here in the second iteration appears the following error:
// "oracle.apps.fnd.framework.OAException: java.lang.ArrayIndexOutOfBoundsException: 1"
//variables string to check if got changes in the column
String columnAPP = r1.getId().toString();
String columnBD = r2.getId().toString();
//'if' that validates changes
if(!columnAPP.equals(columnBD)){
//String variable SP
StringBuilder procedureCall = new StringBuilder();
//calling to SP
try{
procedureCall.append("... stored proc...");
OracleCallableStatement oraclecallablestatement = (OracleCallableStatement)oadbtransactionimpl.createCallableStatement(procedureCall.toString(), -1);
oraclecallablestatement.execute();
getOADBTransaction().commit();
}catch(SQLException sqlexception){
System.err.println("SQL Exception: "+ sqlexception.getMessage());
getOADBTransaction().rollback();
throw OAException.wrapperException(sqlexception);
}catch(Exception e){
System.err.println("Exception: "+ e.getMessage());
getOADBTransaction().rollback();
throw OAException.wrapperException(e);
the first iteration works fine, but the second and futher shows an exception error, what can I do to make this method works?
I'll be pending to your answers, I really hope you can help me with this one
Regards,
Mentor
Here is the dump code for you. Code you have to write in AmImpl and call the same from Controller class.
AMImpl Code
public void executeBothViewObjects() //Calls this method from Controller *ProcessRequest*
OAViewObject vo = (OAViewObject)getMainViewObjectVO1();
OAViewObject dvo = (OAViewObject)getDBViewObjectVO1();
if (vo != null && dvo != null)
//1st VO
dvo.setWhereClauseParams(null);
//Set where clause if Any dvo.setWhereClauseParam(0,xx);
dvo.executeQuery();
//2nd VO
vo.setWhereClauseParams(null);
//Set where clause if Any dvo.setWhereClauseParam(0,xx);
vo.executeQuery();
public void compareViewObject() // Calling this method to compare Attribute of both View Object *Process Form Request*
OAViewObject vo = getMainViewObjectVO1();
OAViewObject OrigVO = getDBViewObjectVO1();
MainViewObjectVORowImpl rowi = null;
DBViewObjectVORowImpl rowii = null;
int fetchedRowCount = vo.getRowCount();
int OriginalfetchedRowCount = OrigVO.getRowCount();
RowSetIterator originalSelectIter = OrigVO.createRowSetIterator("originalSelectIter");
RowSetIterator selectIter = vo.createRowSetIterator("selectIter");
if (fetchedRowCount > 0 && OriginalfetchedRowCount >0)
selectIter.setRangeStart(0);
selectIter.setRangeSize(fetchedRowCount);
originalSelectIter.setRangeStart(0);
originalSelectIter.setRangeSize(OriginalfetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++)
rowi = (MainViewObjectVORowImpl)selectIter.getRowAtRangeIndex(i);
rowii = (DBViewObjectVORowImpl)originalSelectIter.getRowAtRangeIndex(i);
//Compare Attribute here
if((!(rowi.getRoleStartDate().equals(rowii.getRoleStartDate()))
// Comparing Start date here of both View Object
else if(((rowi.getRoleEndDate().equals(rowii.getRoleEndDate()))
// Comparing End date here of both View Object
}Thanks
--Anil
http://oracleanil.blogspot.com/
Similar Messages
-
Comparing two rows field by field through a loop
Hi all,
I've got a tricky issue:
There are two tables (almost) identically designed;
In the first one there are lets say some new data and in the 2nd one there is data to be hold & adjusted;
I built up a third table, which contains the meta informations about the two other tables (i.e. it describes the tables, so for each field of these tables, there is the field name, field type, primary key marker, etc.);
The challenge now is, how can I compare two rows (of the same primary key) field by field and get out the differences (and adjusting the target table row) using PL/SQL procedures/functions.
I thought a create a cursor over the 3rd table and call functions to get the fields out (given by the field name of the cursor), compare the two fields and return if it's equal or different...
As I've seen, there is now direct way to replace a field name in a statement - but how to resolve this with a cool workaround?
In addition, there are about 120 pairs of such tables, to be compared in the same way - so I decided to prevent creating hard coded design for the software.
Even the selection of a pair of rows from the two tables should be parameterized, 'cause the primary keys are of course different in the 120 table pairs.
Any hints or suggestions?
Thanks in advance & regards,
PeterHi Peter,
I am very far from being an expert in Oracle but, everything I've read so far strongly suggests that PL/SQL is often the fastest among the customized solutions (beating even compiled C code). The reason - from what I've understood - is that PL/SQL is part of the Oracle kernel/engine, other languages simply aren't.
I suggest you do your own research to confirm what I've just said above.
On a completely different note, when I first read your post, I started writing a reply and decided to discard it because, I figured you probably would find it too far off your original thoughts. However, then you wrote:
>
There are some reasons to prevent hard coding, but it may be possible to generate the PL/SQL-code for each pair of tables by an external program.
>
This is exactly what I was mentioning in the post I ended up discarding. The basic step by step process I was going to mention is as follows:
STEP 1: If possible, write one PL/SQL program that does the job properly for one set of tables. Test it thoroughly and identify potential differences in the process if it had to be applied against other tables. Make it as generic as reasonably possible, that is, keeping the code as simple as possible.
STEP 2: turn the working code of step 1 into a template (usually replacing table names, columns, etc by some token that would not be a valid name).
STEP 3: generate a list of the tables and their corresponding columns you need to process. This list may need to be massaged a little to become the generating seed of 120 programs (or so based on what you've said).
STEP 4: if you don't know Perl or AWK then (don't be alarmed...) download AWK (not Perl) and learn it... you can learn the thing in a couple days (maybe even less). It is a very simple and straightforward text processing language, I know non progammers that learned enough in one day to do useful things with it. Using AWK you can easily generate the 120 programs you need from a working template in very little time (a few hours after you've become proficient). By the way, there is AWK, GAWK, NAWK, all pretty much the same thing and all free. The standard manual for AWK is the one written by the authors Aho, Weinberger and Kernigan, about 100 small pages, it's an easy read and no programmer should be without it :) (better than American Express!)
What you've described sounds just like the thing to use AWK for. I once used AWK to generate 27,000 (that's 27 thousand) lines of COBOL code, debugged and fully tested in 2 days! (testing was automated using AWK too!) It would have taken much longer to just type all that code.
Anyway, I hope that gives you something to think about and be of some help.
John. -
How to compare two rows in PL/SQL?
Hi All,
How to compare two rows in PL/SQL? Is there any method that I can use instead of comparing them column by column?
Any feedback would be highly appreciated.PhoenixBai wrote:
Hi All,
How to compare two rows in PL/SQL? Is there any method that I can use instead of comparing them column by column?What "rows" are you referring to?
If you're talking of rows within a PL/SQL associative array there are techniques as described in the documentation... e.g.
SQL> ed
Wrote file afiedt.buf
1 declare
2 type v1 is table of number;
3 r1 v1 := v1(1,2,4);
4 r2 v1 := v1(1,2,3);
5 begin
6 if r1 MULTISET EXCEPT DISTINCT r2 = v1() then
7 dbms_output.put_line('Same');
8 else
9 dbms_output.put_line('Different');
10 end if;
11* end;
SQL> /
Different
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 declare
2 type v1 is table of number;
3 r1 v1 := v1(1,2,3);
4 r2 v1 := v1(1,2,3);
5 begin
6 if r1 MULTISET EXCEPT DISTINCT r2 = v1() then
7 dbms_output.put_line('Same');
8 else
9 dbms_output.put_line('Different');
10 end if;
11* end;
SQL> /
Same
PL/SQL procedure successfully completed.
SQL>If you're talking about rows on a table then you can use the MINUS set operator to find the rows that differ between two sets of data...
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20-FEB-1981 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02-APR-1981 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-1981 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-1981 00:00:00 2850 30
7782 CLARK MANAGER 7839 09-JUN-1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19-APR-1987 00:00:00 3000 20
7839 KING PRESIDENT 17-NOV-1981 00:00:00 5000 10
7844 TURNER SALESMAN 7698 08-SEP-1981 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-1987 00:00:00 1100 20
7900 JAMES CLERK 7698 03-DEC-1981 00:00:00 950 30
7902 FORD ANALYST 7566 03-DEC-1981 00:00:00 3000 20
7934 MILLER CLERK 7782 23-JAN-1982 00:00:00 1300 10
14 rows selected.
SQL> select * from emp2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7521 WARD SALESMAN 7698 22-FEB-1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02-APR-1981 00:00:00 2975 20
7782 CLARK MANAGER 7839 09-JUN-1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19-APR-1987 00:00:00 3000 20
7839 KING PRESIDENT 17-NOV-1981 00:00:00 5000 10
7900 JAMES CLERK 7698 03-DEC-1981 00:00:00 950 30
7934 MILLER CLERK 7782 23-JAN-1982 00:00:00 1300 10
7 rows selected.
SQL> select * from emp
2 minus
3 select * from emp2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20-FEB-1981 00:00:00 1600 300 30
7654 MARTIN SALESMAN 7698 28-SEP-1981 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-1981 00:00:00 2850 30
7844 TURNER SALESMAN 7698 08-SEP-1981 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-1987 00:00:00 1100 20
7902 FORD ANALYST 7566 03-DEC-1981 00:00:00 3000 20
7 rows selected.If you actually need to know what columns data is different on "non-matching" rows (based on your primary key) then you'll have to compare column by column. -
Compare two rows in same table
Hi,
I want to compare two rows (some columns) in the same table, and if the data in the data columns is different, I want to pick the latest one. The table is date tracked. For instance I have an address table with different addresses for an employee with effective date. I want to be able to pick the latest row if the postal code is different for the 2 rows. Is this possible in sql. I can do this in Pl/sql, but dont want to use it. Eg
address_id, postal_code, person_id,last_update_date
123, pn123,1,12-JAN-01
124,pu124,1,13-JAN-01
I want to be able to retrieve just the second line.
Any help is appreciatedWelcome to the forum!
Whenever you post please provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
The table is date tracked. For instance I have an address table with different addresses for an employee with effective date. I want to be able to pick the latest row if the postal code is different for the 2 rows.
>
Your question is a little confusing because you are using terms like 'date tracked' and 'effective date' without explaining exactly what your definitions of those terms is.
Why do you want the latest record ONLY if the postal code is different? What if the address is different? Then which record do you want?
Why not just take the record for each person/company that has the latest date? If the data is the same then it doesn't which record you get so the one with the latest date will do. And if the data is different taking the one with the latest date gives you the latest data.
The classic definition of effective date is 'the date the information becomes effective'. Information with a given effective date is NOT in effect before that date and is SUPERCEDED when data is entered with a later effective date if the actual date is later than or equal to the effective date. Using your data
>
123, pn123,1,12-JAN-01
124,pu124,1,13-JAN-01
>
The first record IS NOT effective for dates prior to 12-JAN-01. In fact for a query looking for data prior to that date there isn't any data.
The first record is also NOT effective for dates on or after 13-JAN-01. Only the second record is effective.
If you added a record for 14-JAN-01 this record would not be effective until on or after that date (i.e. not for another 4 1/2 months).
So for the classic definition of effective date the query needs to provide the AS OF date to use to obtain the data. If, as in your system, you are not allowed to create records with dates in the future and you just want the latest record then you can just select the record with the MAX(myDate) value for the given person_id, address_id or whatever your key values are.
Edited by: rp0428 on Aug 11, 2012 7:50 AM -
Compare two rows in a same table
Dear all
I need to compare two rows in the same table, I dont know hoe to do it in pl/sql. Some one please help me on this.
example:
tr br price
xya0001 ama7 12
xya0003 ama6 14
xya0004 ama7 16
in the table tr is a unique value for each row, I need to compare price column and see whether the first value is less or greater than the next value and, if it is greater put the corresponding br value to a variable and if it is smaller put the corresponding br value to another variable. I dont know a method to do it, as I'm new to pl/sql. Some one please help me in thisnot sure what you intend to do as you have mentioned that "TR" is unique and you just want to compare each record with just the next record. Hope below query helps. The value "G" or "L" in flag would indicate if the current records price is greater than or less than the price in next record.
select tr,br,price,col4, case when price> col4 then 'G' when price< col4 then 'L' end flag from (
select tr,br,price,lag(price,1,0) over(order by tr) col4 from testcomp
) -
How to compare two rows from two table with different data
how to compare two rows from two table with different data
e.g.
Table 1
ID DESC
1 aaa
2 bbb
3 ccc
Table 2
ID DESC
1 aaa
2 xxx
3 ccc
Result
2Create
table tab1(ID
int ,DE char(10))
Create
table tab2(ID
int ,DE char(10))
Insert
into tab1 Values
(1,'aaa')
Insert
into tab1 Values
(2,'bbb')
Insert
into tab1 Values(3,'ccc')
Insert
into tab1 Values(4,'dfe')
Insert
into tab2 Values
(1,'aaa')
Insert
into tab2 Values
(2,'xx')
Insert
into tab2 Values(3,'ccc')
Insert
into tab2 Values(6,'wdr')
SELECT
tab1.ID,tab2.ID
As T2 from tab1
FULL
join tab2 on tab1.ID
= tab2.ID
WHERE
BINARY_CHECKSUM(tab1.ID,tab1.DE)
<> BINARY_CHECKSUM(tab2.ID,tab2.DE)
OR tab1.ID
IS NULL
OR
tab2.ID IS
NULL
ID column considered as a primary Key
Apart from different record,Above query populate missing record in both tables.
Result Set
ID ID
2 2
4 NULL
NULL 6
ganeshk -
Hello all,
I keep getting exceptions using the code for a table cell renderer listed below.
Basically, the program blows up whenever the renderer is asked to compare two floats.
Two string values, a string and a float, it does not have the desired effect, but a least it runs.
" public Object[][] aaTableValues = {
{ new Float( 700.00 ), new Float( 300.00 ), new Float( 400.00 ), "Fred", "Snead", "inform", "detail" },
{ new Float( 1000.00 ), new Float( 200.00 ), new Float( 800.00 ), "Jane", "Smith", "limit", "detail" },
{ new Float( 500.00 ), new Float( 200.00 ), new Float( 300.00 ), "Mary", "Ellis", "inform", "detail" },
table1.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, column);
// Prepare default color
Color color = isSelected ? table.getSelectionForeground(): table.getForeground();
if (column == 1) {
float val1 = 0.0F;
val1 = ((Float)value).floatValue();
float val2 = ((Float)table.getValueAt(row, column - 1)).floatValue();
if( val1 > val2) {
color = isSelected ? Color.red.brighter() : Color.red;
setForeground(color);
return this;
});I get the runtime exceptions like the following:
"Caught exception updating ExitableJFrame[frame0,0,0,618x430,invalid,layout=java.awt.BorderLayout,resizable,title=AccountActivityTable,defaultCloseOperation=,rootPane=javax.swing.JRootPane[,0,0,618x430,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=2,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true,EXIT_ON_CLOSE]:
java.lang.NullPointerException
at FloatRenderer.getTableCellRendererComponent(Compiled Code)
at javax.swing.JTable.prepareRenderer(JTable.java:2897)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:968)
at javax.swing.plaf.basic.BasicTableUI.paintRow(BasicTableUI.java:899)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:811)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:43)
Does anyone know how to fix this?If you look again at the error message, you'll see it's a NullPointerException. You are using a null reference. Nothing at all to do with comparing two float values. I'd guess that "table.getValueAt(row, column - 1)" is returning null, but it's hard to tell without a line number. You need to do some debugging in that code to see where you are using the null reference.
-
Hi all,
I am nearing the completion of a program and have been snagged on a problem. The problem is have 2 lists, i want to see if list2 contains all the elements list1 conatins. If it does return true, if not return false. I have tried and tried but cant come up with a simple solution. Hopefully someone out there is able to help me.
Cheers Dave.It either does or doesn't have elements, and if it
does it contains more then 2, i have tested for
this.
I also put a System.out.println(list); before the if
statement which returns the list [ ] being empty but
then carries out the statement even though the list
is == null.Nope, a list variable is either null, or not. When the reference is not
null, the list can be empty, can contain one element or more elements.
Being empty does not imply null. Try something like this:if (list != null && list.size() > 1) //remove two elementskind regards,
Jos -
How to compare two rows in PL/SQL and retrieve the values?
Hello,
I have two tables which have identical schemas, one table (tbl_store) is used to hold the latest version, and the other table (tbl_store_audit) holds previous versions. When the latest record is updated, it is inserted into the tbl_store_audit table as a revision, and the updated details are used as the latest record.
For example: The latest version is held in tbl_store, however the tbl_store_audit may hold 5 records which are the past records used before changes were made - these are seen as revisions.
I want to be able to compare what has changed between each revision in the tbl_store_audit table. For example: Out of the 10 columns, the change between revision 1 and revision 2 was the size from XL to XXL. The change between revision 3 and revision 4 was the size XS to M and price 4.99 to 10.99, and so on.
Eventually i will create an APEX report that will show the user the revision number and what was changed from and to.
I seen in a previous post i need to note my oracle version: Oracle version 10.2.0.4.0Hi,
Like suggested already you should give some sample data and output.
Maybe you would like to have something like this:
-- Sample data
-- Note PK is the primairy key of the source table and rev are the revisions
with tbl_store_audit as
select 1 pk, 1 rev , 1 price , 'XXL' unit_size from dual union all
select 1 pk, 2 rev , 1 price, 'XL' unit_size from dual union all
select 1 pk, 3 rev , 1.4 price, 'XXL' unit_size from dual union all
select 2 pk, 1 rev , 1.4 price, 'XL' unit_size from dual union all
select 2 pk, 2 rev , 1.4 price, 'XL' unit_size from dual union all
select 2 pk, 3 rev , 1.4 price, 'XL' unit_size from dual union all
select 1 pk, 4 rev , 1 price , 'XL' unit_size from dual union all
select 1 pk, 5 rev , 1 price , 'XL' unit_size from dual union all
select 3 pk, 1 rev , 1.2 price, 'XL' unit_size from dual union all
select 3 pk, 2 rev , 1.2 price, 'XXL' unit_size from dual union all
select 4 pk, 1 rev , 1 price , 'XL' unit_size from dual
-- end of sample data
,tbl_store_audit_tmp as
select
pk
,rev
,'PRICE' field_name
,to_char(price) field_value
,to_char(lag(price,1) over (partition by pk order by rev) ) old_field_value
from
tbl_store_audit
union all
select
pk
,rev
,'UNIT_SIZE' field_name
,to_char(UNIT_SIZE) field_value
,to_char(lag(UNIT_SIZE,1) over (partition by pk order by rev) ) old_field_value
from
tbl_store_audit
-- include all other fields from the table here with it's own union all select ...
select
from
tbl_store_audit_tmp
where
field_value != old_field_value
PK REV FIELD_NAME FIELD_VALUE OLD_FIELD_VALUE
1 3 PRICE 1.4 1
1 4 PRICE 1 1.4
1 2 UNIT_SIZE XL XXL
1 3 UNIT_SIZE XXL XL
1 4 UNIT_SIZE XL XXL
3 2 UNIT_SIZE XXL XL
6 rows selected If you realy want to keep track of all the changes I think it would be better if you make a "after update trigger" on the base table that checks what changed and put that directly in the uadit table.
Regards,
Peter
Edited by: Peter vd Zwan on Aug 16, 2012 8:25 AM -
I WANT TO COMPARE A SINGLE ENTITY IN A ROW WITH A ENTITY FROM THE OTHER ROW IN A JTABLE.COULD ANY BODY HELP ME OUT.I BEG YOUR PARDON FOR MY ENGLISH.
Message was edited by:
DHIRAJKUMARUse getValueAt(). And press your caps-lock key, please.
-
Comparing two rows, pair by pair
Ok, this SHOULD be easy, but having tried this about 20 different ways (with the most common error that a range can't be used as a single number), I have given up.
I have 2 rows of numbers. I want to compare the pair of cells in the same column and if my comparison is true for EVERY pair, then the IF is true.
For example:
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Header 7
Header 8
20
12
13
15
2
TRUE or 1 or something
20
91
15
29
1
15
3
So, each cell in the top row is less than or equal to the matching cell in the bottom (for the first 7 columns), therefor it is TRUE in Column 8.
For just ONE attempt, I tried =AND(A1:A7<=B1:B7), which of course gives me "The range A1:A7 can't be used as a single number".Hi Mark,
"Numbers isn't c++, and doesn't do array or matrix calculations."
True enough.
Here's another formula, similar to Wayne's in the amount of work needed to set it up.
=MAX(A2-A3,B2-B3 ,C2-C3 ,D2-D3 ,E2-E3 ,F2-F3 ,G2-G3 )<=0
It assumes the data is all numerical.
Wayne's suggestion to use his second (and simpler) formula 'with caution' is well taken. It's not difficult to show several examples where it will produce wrong results:
Regards,
Barry -
Comparing two SharePoint Lists, three variables in each
I have a data set in a SharePoint list, Column 1, 2, 3,4.
I have a second data set in a SharePoint list, with the same columns 1-3 in it.
I would like to create a workflow (I think) that when a new record is added to the first data set, it checks the second data set to see if there is a record with the same matching three records. If there is a match it would change column 4 in the first file
to "TRUE".
Looking for some help here... I know how to do a look up for one value, and even a lookup to look at two different values independently, but this lookup needs to make sure that all three columns in the record are a match.
ThanksHi,
I'm assuming you mean for List 1 you have four fields and an additional field with the date (MyDate for example).
And that in List 2 you have three fields plus two more date fields (EffectiveDate and ExpirationDate for example)
For this scenario I would create 2 workflow variables:
1. Combined (string) - same as before that builds up the three fields in List1
2. List2Id - that gets the ID of the List Item in List2 that matches (if none match then List2Id will be 0) using the following settings:
Data source: List2
Field from source: ID (As List Item Id - IMPORTANT)
Field: Combined
Value:Variable:Combined
Then use an if condition to check:
If Variable: List2Id not equals 0
then within this if condition create another sub if condition to check the following:
If Current Item:MyDate is greater than or equal to List2:EffectiveDate
AND Current Item:MyDate is less than or equal to List2:ExpirationDate
If both conditions are true then update field four in List1 to True.
Settings to get List2:EffectiveDate are below:
Data source: List2
Field from source: EffectiveDate (As Date/Time)
Field: ID
Value:Variable: List2Id (Return field as: Item Id - IMPORTANT)
Settings to get List2:ExpirationDate are below:
Data source: List2
Field from source: ExpirationDate(As Date/Time)
Field: ID
Value:Variable: List2Id (Return field as: Item Id - IMPORTANT) -
hi all,
In my report there is a table with 3 rows. I have to put a direction image at 4th row based on the difference of 2nd and 3rd row.
can anyone help me?
Thanks in advance.Hi Tanjima,
In what way you want ot compute the difference between the 2nd and 3rd rows of data?
It would be of great helps if you paste the report data here and Explain what you want in your rows?
You can't refer indivisual cell or individual row in WEBI everything you want to do you have to do it using column references.
Thanks..
Pratik -
Problem comparing two ArrayLists, elements must match, order not important.
Hello,
I am new to Java and my assignment is:
Write a method for the Purse class - public boolean sameCoins(Purse other), that checks whether the other purse has the same coins, perhaps in a different order.
For example, the purses:
*Purse[Quarter,Dime,Nickel,Dime]*
and
*Purse [Nickel,Dime,Dime,Quarter]*
should be considered equal.
You will probably need one or more helper methods.
I was able to make a method to check if the purses match(sameContents), but I have not been able to check if they match just based on elements(sameCoins). We are not using Collections.
Below is my Purse Class:
import java.util.ArrayList;
public class Purse {
private ArrayList<String> coins;
public Purse() {
coins = new ArrayList<String>();
public void addCoin(String coinName) {
coins.add(coinName);
public String toString() {
String text = "Purse[ ";
for (String a : coins)
text += a;
text += "]";
return text;
public boolean sameContents(Purse other) {
boolean content = false;
if (other.coins.equals(coins))
content = true;
return content;
public boolean sameCoins(Purse other){
boolean samecoins = true;
for(String a: coins)
for(String b: other.coins)
if (a.contains(b))
samecoins = true;
else
samecoins=false;
return samecoins;
}Any help would be appreciated.tipalm wrote:
Well then my prof cant hold it against me can he!He sure can, if he wants to. I'll bet you 30 duke stars that if you hand in the program as-is and try to argue for using the Collections framework, he's going to say "I meant you couldn't use any of the static methods in the Collections framework, the whole point of the assignment was to work through the logic of iterating through the Lists" But hey, it's not my assignment, so good luck!
Edit- I'm not saying that using the Collections framework (and its myriad static methods) is bad in any way. It's actually what you should use, assuming there are no academic "but don't use this shortcut" rules being applied. I just doubt that's your case here. I'd recommend looking into how the Collections framework works, and then implement your own algorithm based on that.
Edited by: kevinaworkman on Oct 29, 2009 10:13 AM -
List aggregate two rows into one
query :
select kod_negeri.NAMA kod_negeri_nama,
hakmilik.id_hakmilik,
MOHON.PENYERAH_NAMA,
MOHON.PENYERAH_ALAMAT1, MOHON.PENYERAH_ALAMAT2, MOHON.PENYERAH_ALAMAT3,
MOHON.PENYERAH_ALAMAT4, MOHON.PENYERAH_POSKOD, MOHON.PENYERAH_KOD_NEGERI,
MOHON.PENYERAH_NO_RUJ, MOHON.ID_MOHON, HAKMILIK.KOD_HAKMILIK, HAKMILIK.NO_HAKMILIK,
KOD_LOT.NAMA, HAKMILIK.NO_LOT, KOD_BPM.NAMA, KOD_DAERAH.NAMA,
LELONG.TMPT, LELONG.DIMASUK, PGUNA.NAMA,
PIHAK.ALAMAT1, pihak.NAMA ven,
PIHAK.ALAMAT2, PIHAK.ALAMAT3, PIHAK.ALAMAT4, PIHAK.POSKOD,
mohon.id_mohon ,
pguna.NAMA pguna_nama,
pguna.JAWATAN,
kod_daerah.NAMA kod_daerah_nama,
to_char(enkuiri.TRH_enkuiri,'DD')||' '|| to_char(enkuiri.TRH_enkuiri,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (enkuiri.TRH_enkuiri, 'YYYY') trh_enkuiri,
to_char(lelong.TRH_lelong,'DD')||' '|| to_char(lelong.trh_lelong,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (lelong.TRH_lelong, 'YYYY') trh_le,
to_char(lelong.trh_lelong, 'Day') day,
to_char(lelong.TRH_lelong,'HH12:MI ') hour,
DECODE(SUBSTR(to_char(lelong.TRH_lelong,'HH12:MI AM'),-2,2),'AM','Petang','pagi') noon,
enkuiri.cara_lelong,
lelong.TMPT,
lelong.HARGA_RIZAB,
enkuiri.harga_rizab,
initcap(pihak.NAMA) pihak_nama,
initcap(lelong.EJA_RIZAB) er,
'RM'||enkuiri.TUNGGAK_AMAUN,
lelong.DEPOSIT,
convert_number_words(lelong.DEPOSIT) as converted_form,
to_char(lelong.TRH_AKHIR_BYR,'DD')||' '|| to_char(lelong.TRH_AKHIR_BYR,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (lelong.TRH_AKHIR_BYR, 'YYYY') TRH_AKHIR_BYR,
to_char(sysdate,'DD') ||' '|| to_char(sysdate,'MONTH','nls_date_language=malay') ||' '||to_char(sysdate,'yyyy') sysd,
kod_bpm.NAMA kod_bpm_nama,
kod_lot.NAMA kod_lot_nama,
hakmilik.NO_LOT,
hakmilik.KOD_HAKMILIK,
hakmilik.NO_HAKMILIK
from
mohon ,
mohon_hakmilik ,
lelong ,
pguna ,
pihak ,
kod_daerah ,
enkuiri ,
kod_bpm ,
hakmilik ,
kod_lot ,
kod_negeri,
mohon_fasa ,
kod_hakmilik
WHERE mohon.id_mohon = mohon_hakmilik.id_mohon and
mohon_hakmilik.id_hakmilik = hakmilik.id_hakmilik and
hakmilik.kod_hakmilik = kod_hakmilik.kod(+) and
hakmilik.kod_lot = kod_lot.kod(+) and
hakmilik.kod_bpm = kod_bpm.kod(+) and
hakmilik.kod_daerah = kod_daerah.kod(+) and
mohon.id_mohon = enkuiri.id_mohon and
lelong.id_pihak = pihak.id_pihak and
lelong.id_mh = mohon_hakmilik.id_mh and
pihak.kod_negeri = kod_negeri.kod(+) and
mohon.id_mohon = mohon_fasa.id_mohon and
mohon_fasa.id_aliran ='semakan' and
mohon_fasa.id_pguna = pguna.id_pguna and
mohon.id_mohon = :p_id_mohon
and enkuiri.KOD_STS='AK'
and mohon.id_mohon ='0405AUC2010007436'KOD_NEGERI_NAMA,ID_HAKMILIK,PENYERAH_NAMA,PENYERAH_ALAMAT1,PENYERAH_ALAMAT2,PENYERAH_ALAMAT3,PENYERAH_ALAMAT4,PENYERAH_POSKOD,PENYERAH_KOD_NEGERI,PENYERAH_NO_RUJ,ID_MOHON,KOD_HAKMILIK,NO_HAKMILIK,NAMA,NO_LOT,NAMA_1,NAMA_2,TMPT,DIMASUK,NAMA_3,ALAMAT1,VEN,ALAMAT2,ALAMAT3,ALAMAT4,POSKOD,ID_MOHON_1,PGUNA_NAMA,JAWATAN,KOD_DAERAH_NAMA,TRH_ENKUIRI,TRH_LE,DAY,HOUR,NOON,CARA_LELONG,TMPT_1,HARGA_RIZAB,HARGA_RIZAB_1,PIHAK_NAMA,ER,'RM'||ENKUIRI.TUNGGAK_AMAUN,DEPOSIT,CONVERTED_FORM,TRH_AKHIR_BYR,SYSD,KOD_BPM_NAMA,KOD_LOT_NAMA,NO_LOT_1,KOD_HAKMILIK_1,NO_HAKMILIK_1
Johor,050503PM00000151,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,PM,151,Lot,6309,Mukim Lenggeng,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,ASDFSAF,AHMAD,DSFDS,FDSFSDF,DSFSDF,12345,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ahmad,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Lenggeng,Lot,6309,PM,151
,050540HSD00022923,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,HSD,22923,Lot,0009838,Mukim Jimah,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,no2,Ali Bin Abudillah,jalan 3,taman permata,lorong mentari,32333,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ali Bin Abudillah,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Jimah,Lot,0009838,HSD,22923
KOD_NEGERI_NAMA,ID_HAKMILIK,PENYERAH_NAMA,PENYERAH_ALAMAT1,PENYERAH_ALAMAT2,PENYERAH_ALAMAT3,PENYERAH_ALAMAT4,PENYERAH_POSKOD,PENYERAH_KOD_NEGERI,PENYERAH_NO_RUJ,ID_MOHON,KOD_HAKMILIK,NO_HAKMILIK,NAMA,NO_LOT,NAMA_1,NAMA_2,TMPT,DIMASUK,NAMA_3,ALAMAT1,VEN,ALAMAT2,ALAMAT3,ALAMAT4,POSKOD,ID_MOHON_1,PGUNA_NAMA,JAWATAN,KOD_DAERAH_NAMA,TRH_ENKUIRI,TRH_LE,DAY,HOUR,NOON,CARA_LELONG,TMPT_1,HARGA_RIZAB,HARGA_RIZAB_1,PIHAK_NAMA,ER,'RM'||ENKUIRI.TUNGGAK_AMAUN,DEPOSIT,CONVERTED_FORM,TRH_AKHIR_BYR,SYSD,KOD_BPM_NAMA,KOD_LOT_NAMA,NO_LOT_1,KOD_HAKMILIK_1,NO_HAKMILIK_1
Johor,050503PM00000151,HAMZAH DAUD DAROS & SITI NOR,NO 12 1ST FLOOR & 2ND FLOOR,JLN SRI RAHANG,TMN SRI RAHANG,SEREMBAN,58000,05,12345,0405AUC2010007436,PM and HSD,151 and 22923,Lot,6309,Mukim Lenggeng,Seremban,PTG MELAKA,pptlelong1,Puan Nur Faizati,ASDFSAF,AHMAD,DSFDS,FDSFSDF,DSFSDF,12345,0405AUC2010007436,Puan Nur Faizati,Penolong Pegawai Tanah Lelong (PTD),Seremban,08 DISEMBER 2010,27 JANUARI 2011,Thursday ,02:00 ,pagi,A,PTG MELAKA,,,Ahmad,,RM234,,,24 MEI 2011,10 FEBRUARI 2011,Mukim Lenggeng,Lot,6309,PM,151
that means i need to list aggregate the two rows into one how to make the changes for the above query in order to do so .
Edited by: user9093689 on Feb 9, 2011 10:03 PMuser9093689 wrote:
now need to bother abt this that line converts date into malay language
to_char(enkuiri.TRH_enkuiri,'DD')||' '|| to_char(enkuiri.TRH_enkuiri,'MONTH','nls_date_language=malay') ||' '||TO_CHAR (enkuiri.TRH_enkuiri, 'YYYY') trh_enkuiri,iam retriving two rows of output, wat i need is to display one row and the second row values which are not similar should be added to the first row
for example for column
kod_hakmilik two rows values are
PM
HSD
but they should be display as
PM and HSD
finally my aim is to retrieve only one row as output.
i dont how exactly the term listaggr . how ever it may be whether using groupby or any other but the output should be as aboveWhat version of Oracle are you on?
Look up the LISTAGG() function in the documentation for your version (assuming it is there) and see if it can do what you want
Maybe you are looking for
-
I need help! I want to sync up my ipod, but it won't let me. I recently got a new computer and transferred my music through homeshare. Some of my songs from my old computer don't show up in my library on my new computer (which is actually slightly ol
-
Need help msi 945pl neo crashed within 3 months use
need help. my mobo doesnot start, no post, no beep. 1.main board 945pl neo(MS-7236) 2.video card: msi RX300HM TD128E 3.CPU Type: pentium 4 3Ghz (531) 4.Memory Type:512mb ddr2 533 kingston 5.Power Supply Type:generic 500W 6.Operating System:windows x
-
Anyone own Mac Mini and MacBook Air?
Looking for shopping advice from people owning a particular configuration of Apple devices. I currently have a white MacBook and iPad. Thinking of upgrading/shifting to one of these configurations: 1. 15" MacBook Pro, iPad 2. 15" MacBook Pro, iPhone
-
Easy Cost Planning in a currency other than Cont Area and comp code curren
Hi, I want to do the easy cost planning in a currency which is other than controlling area and company code currency. But I am getting the option of only these two currencies only. Any idea how to do it? Example: Controlling Area currency :IN
-
Java installer to launch another native installer
Hi guys, Objective i want to achieve: produce a multi-platform installer (Windows 2000/XP/2003 Server/Vista and Linux) that installs Open Office and write to a .properties file the path folder where OpenOffice is installed. for linux i want to use co