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,
Peter
Hi 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.
Similar Messages
-
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 -
Is it possible to have two rows of text fields per entry in a tabular form?
Hi,
I'm constructing a tabular form with several text fields for each entry, and I have just been advised we need twice as many text fields now as the requirements have changed.
Anyway I am running out of real estate on the page without having to use horizontal scroll bars, and am wondering if it is possible to arrange the text fields into two rows in the tabular form for data entry. I have successfully done this for display as text fields, but not sure if it can be done in this instance.
Any help would be greatly appreciated.
Application Express 4.1.1.00.23
Greg
Edited by: Snowman on Nov 30, 2012 12:02 PMSnowman wrote:
Hi,
I'm constructing a tabular form with several text fields for each entry, and I have just been advised we need twice as many text fields now as the requirements have changed.In the first place I'd strongly recommend not using tabular forms: +{thread:id=850889}+.
Anyway I am running out of real estate on the page without having to use horizontal scroll bars, and am wondering if it is possible to arrange the text fields into two rows in the tabular form for data entry. I have successfully done this for display as text fields, but not sure if it can be done in this instance.If you must, create a custom named column template and base the tabular form report on this: {message:id=10399762} -
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,
MentorHere 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/ -
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 -
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 -
Hi,
I have a requirement where i check an table against a list of values in reference data.
I get two rows with just one column each as output every time and i need to concatenate the two rows into one field.
Is there any processor/combination that can be used to do this ?
I have tried concatenate / Merge and Data Merge processors without success.
Any direction is much appreciated.
Thank you,
SidHi Mike,
Here is my target:
I have a CSV file with certain columns:
Column 1 and Column 2 hold some data i am interested in.
I use a reference data to compare column 2 to a list of 2 values. That returns me two rows - always.
Now i want to concatenate value in column 1 for those two rows and that will be my output.
I have nothing to group by and column 1 has completely different values in it.
Like:
C1 C2
This is string1 Value Matched with Ref Data1
This is string2 Value Matched with Ref Data2
Now am trying to do something that can give me "This is String1~This is String2"
Thanks,
Sid -
Compare two characteristics in Query
Hi Experts,
I have to compare two characteristics in Query fields like (A)Approved Level of Job(contain values like 01,02,03,04) and (B)Required Level of Job(contain values like 01,02,03,04).
Now I have to do these calculations
If A>B =1
If A<B =0
And also in other case
If A=b then value 1
Of A =/= B then value 0
Please let me know how I can achieve this.
These values could be in A,B,C,D instead of 01,02,03,04 then in that case how I will calculate these comparison.
Thanks
Take care
Vishal sharmaHi,
i need the solution in this format on the comparison two characteristics in Query:
0=false
1=true
Approved Level of Job(A) Required Level of Job(B) A=B A not equal B A>B A<B
1 3 0 1 0 1
4 2 0 1 1 0
3 3 1 0 1 1
5 4 0 1 1 0
1 2 1 1 0 1
count(A):5 Count(B)5 sum 2 sum 4 sum 3 sum 3
so my CKF will be
A>B/5 means 3/5=60%
I also need to know how i am going to count A and B too.
thanks
take care
vishal sharma -
Comparing two characteristics in query.
Hi,
In my CKF, I want to compare two different characteristics. Field 1 contains the value 'Y' and 'N' while Field 2 contains the value 'SP' and 'MP'. I tried to create a formula variable using key but the dimension ID supports does not give option of char.
In the query i am trying to compare both the fields:
((Field 1 == 'Y')AND(Field 2 =='SP'))* (20 - X)+ ((Field 1 == 'Y')AND(Field 2 =='MP'))* (30 - X)
Can anyone kindly suggest what can be done in this case. Any suggestion would be of gr8 help to me.
Thanks
Palak Vyasai think its alomost not possible what you are trying to achieve (no idea if there is a way)..
but i have an idea..why don't you try out with restricted KeyFigures?
Create two dummy RKFs and hide them.
RKF1: combination of Field1=Y,Field2=SP,and any Base KF.
RKF2: combination of Field1=Y,Field2=MP,and same Base KF.
Then try this formula:
(RKF1<>0)(20 - X)+(RKF2<>0)(30 - X)
One of these RKFs must be zero always then only you get desired result..isnt it?
as both RKFs are restricted by same KF and Same Field1 but different Field2,one them should be zero always. -
Compare two fields of one table in selection.
Dear Experts,
I want to compare two fields of a table and make selection according to this.
Ex: simply i want to select the rows from table mard where mard-labst>mard-insme. Could you write me the code to make this selection.Yes, Thomas,
Its working:
Sample code:
data: begin of itab occurs 0,
matnr type matnr,
ernam type ernam,
end of itab.
select matnr ernam
into table itab
from mara where brgew > mara~ntgew.
loop at itab.
write: itab-matnr.
endloop.
Or,
Try with inner join once.
Its working: Sample code.
data: begin of itab occurs 0,
matnr type matnr,
ernam type ernam,
end of itab.
select p~matnr q~ernam
into table itab
from mara as p
inner join mara as q
on p~brgew > q~ntgew.
loop at itab.
write: itab-matnr.
endloop.
Thanks,
Naveen.I
Maybe you are looking for
-
Have questions about your Creative Cloud or Subscription Membership?
You can find answers to several questions regarding membership to our subscription services. Please see Membership troubleshooting | Creative Cloud - http://helpx.adobe.com/x-productkb/policy-pricing/membership-subscription-troubleshooting- creative
-
Integrated GPU (or driver) fails on built-in screen only: Mid 2009 MBP 15
Hello All, Long time reader, first time poster. Thanks in advance for your valuable time helping with this strange issue. Note: This MBP uses dual GPU's, but does not feature automatic graphics switching; graphics switching is either accomplished by
-
Is there a command to capitalize the first letter of each word?
That is to say, can you capitalize the first letter of each word in a document like say, word? Or using the net? Thanks guys. (hope that makes sense.)
-
How to use driver emulation in opengl profile
I'm trying to use the OpenGL Profiler to resolve a bug happened on the Mac of a client. I read in the OpenGL Profiler User Guide, we can the driver emulation to emulate an Grpahics Card Driver not existing on local machine, just by select the wanted
-
Saving existing files in their native formats
It's really annoying that Numbers insists on saving in its own proprietary format. Is there a way around this and is there a chance that the default behavior would ever be changed? I've just had my first experience with Numbers since it was pre-insta