Compare 2 value
Hi All,
I want to compare 2 values in same internal table.
like.
belnr qty qty1
1234 12 1
1234 12 2
I want to compare belnr value and put qty = 0 if belnr is duplicate.
like
belnr qty qty1
1234 12 1
1234 00 2
please help me.
thanks in advance.
HI
i AM USING FOLLOWING CODE..
ITAB , AND ITAB1 BOTH R INTERNAL TABLES
AND I AM APPENDING THEM IN ONE..
i AM GATING OUT PUT LIKE THIS:
40559178 110.000 138.000 701002 202630
40559178 4.000 138.000 701002 202630
40559178 24.000 138.000 701002 202630
I WANT OUTPUT LIKE :
40559178 110.000 138.000 701002 202630
40559178 4.000 000.000 701002 202630
40559178 24.000 000.000 701002 202630
FOR THIS OUTPUT I AM USING FOLLOWING CODE.
DATA : CHECK TYPE C.
LOOP AT ITAB.
LOOP AT ITAB1 WHERE MBLNR_REG = ITAB-MBLNR_SRP .
MOVE : ITAB-MBLNR_SRP TO ITAB3-MBLNR_SRP,
ITAB-MATNR_SRP TO ITAB3-MATNR_SRP,
ITAB-MENGE_SRP TO ITAB3-MENGE_SRP,
ITAB1-MENGE_REG TO ITAB3-MENGE_REG,
ITAB1-MATNR_REG TO ITAB3-MATNR_REG.
APPEND ITAB3.
CHECK = 'X'.
ENDLOOP.
IF CHECK = ' '.
ITAB3-MATNR_REG = SPACE.
ITAB3-MENGE_REG = SPACE.
APPEND ITAB3.
CLEAR CHECK.
ENDIF.
ENDLOOP.
IS IT RIGHT?
Similar Messages
-
Need to compare values in two columns of one table against values in two columns in another table
Hi, as the title reads, I'm looking for an approach that will allow me to compare values in two columns of one table against values in two columns in another table.
Say, for instance, here are my tables:
Table1:
Server,Login
ABCDEF,JOHN
ABCDEF,JANE
FEDCBA,SEAN
FEDCBA,SHAWN
Table2:
Server,Login
ABCDEF,JOHN
ABCDEF,JANE
FEDCBA,SHAWN
In comparing the two tables, I'd like my query to report the rows in table1 NOT found in table2. In this case, it'll be the 3rd row of table one:
Server,Login
FEDCBA,SEAN
Thanks.create table Table1([Server] varchar(50), Login varchar(50))
Insert into Table1 values ('ABCDEF','JOHN'),('ABCDEF','JANE'),('FEDCBA','SEAN'),('FEDCBA','SHAWN')
create table Table2([Server] varchar(50), Login varchar(50))
Insert into Table2 values ('ABCDEF','JOHN'),('ABCDEF','JANE'), ('FEDCBA','SHAWN')
select [Server] ,Login from Table1
Except
select [Server] ,Login from Table2
select [Server] ,Login from Table1 t1
where not exists(Select 1 from Table2 where t1.[Server] = t1.[Server] AND Login=t1.Login)
drop table Table1,Table2 -
Required UDF for comparing values within same context
I have to compare values within the same context.I am getting boolean values for that field.If all the values in the same context are true,then the result should be true .Otherwise false should be passed.
If input is-
<context>
true
false
true
<context>
true
true
<context>
Output should be as-
<context>
false
<context>
true
<context>
Please suggest how to acheive this?..its urgentHi,
Check with this UDF
Src>UDF>target
public void context1(String[] a,ResultList result,Container container)
int k = 0;
int arrayLength = a.length;
if (arrayLength > 0)
String firstElement = a[0];
for (int i = 1; i < arrayLength; ++i)
if(!(a<i>.equalsIgnoreCase(firstElement)))
k = 0;
break;
else
k = 1;
if(k == 1)
result.addValue("true");
else
result.addValue("false"); -
Comparing values in different tables
Hi,
I am trying to compare values in two different table fields, can someone advise me of the ABAP to do it.
I need to find IHPA-PARNR(partner number) in table T527X-ORGEH(org unit number)
Thanks,
AlecOK now I'm confused:
I put a breakpoint as follows:
SELECT * FROM t527x INTO TABLE it_t527x.
LOOP AT it_ihpa INTO wa_ihpa.
READ TABLE it_t527x INTO wa_t527x WITH KEY orgeh = wa_ihpa-parnr
BINARY SEARCH.
IF sy-subrc EQ 0.
BREAK-POINT.
WRITE: wa_t527X-ORGTX TO ZORGUNITTEXT.
ELSE.
WRITE: 'Damn it' TO ZORGUNITTEXT.
ENDIF.
ENDLOOP.
I have the correct values in the correct fields but still SUBRC does not = 0
WA_T527X-ORGTX Stockton - Front of House
ZORGUNITTEXT Damn it
WA_t527X-ORGEH 20008855
WA_IHPA-parnr 20008855
Whats Wrong?
Edited by: Alec Fletcher on Dec 19, 2008 1:50 PM -
Comparable[] items, Comparable value
how can I change this
public static boolean search(Comparable[] items, Comparable value, int low, int high) {
if (low > high) return false;
int middle = (low + high) / 2;
if (items[middle].equals(value)) return true;
if (value.compareTo(items[middle]) < 0) {
// recursively search the left part of the array
return search(items, value, low, middle-1);
else {
// recursively search the right part of the array
return search(items, value, middle+1, high);
TO
public static boolean binarySearch(int[] nums, int value, int low, int high) {
}By simply changing the method signature and the code?
-
How to compare values in table control
Hi Experts,
How to compare two values of a field in table control. Like the frist row of feld1 with the second row of field1.
because when ever two values are same i need to display error message that we are entring duplicate entry.
i have been tring for a very log time but not getting any solution for this.
Thanks and Regards,
Ashwin.you need to write in code for this..
A possible solution is given below..
Suppose your internal table fields are col1 and col2.
in the loop .....endloop of yout internal table in your PAI..there will be following(if your table control is made using wizard. otherwise you might have to add it..
loop at itab.
chain.
field col1.
field col2.
"some module
endchain.
endloop.
now make changes as shown to the above code..
loop at itab.
chain.
field wa-col1.
field wa-col2.
module table_modify on chain-request.
endchain.
now in your program add module table modify.
module table_modify input.
read table itab with key col1(which shud be unique) = wa-col1 transporting no-fields.
if sy-subrc = 0. " there exists another record with the same value
message e001(your message class).
endif.
endmodule.
i guess that shud work. get back if it dosnt.
regards
Suzie -
How to compare value of two Combo Box
I've two Combo Box(cbFirst & cbSecond). I want to compare the value that has been selected by the user and based on the result, output is displayed. In both Combo Box I've provided the value.
Here is my code:
var a:Number;
var b:Number;
function First(evt:Event):void{
a = evt.target.value;
trace(a);
cbFirst.addEventListener(Event.CHANGE, First);
function Second(evt:Event):void{
b = evt.target.value;
trace(b);
cbSecond.addEventListener(Event.CHANGE, Second);
If (a > b){
trace("a is greater")
else
trace(b is greater);
The trace statement inside the functions are working fine and the correct value of a & b is printed. But the comparison in the if statement doesn't seem to work. Could you please help me out.there's a typo. fix it or remove it:
var a:Number;
var b:Number;
function First(evt:Event):void{
a = evt.target.value;
trace(a);
compareF();
cbFirst.addEventListener(Event.CHANGE, First);
function Second(evt:Event):void{
b = evt.target.value;
trace(b);
compareF()
cbSecond.addEventListener(Event.CHANGE, Second);
function compareF(){
If (a > b){
trace("a is greater")
else
trace(b is greater); -
How to compare values in resultset
i am having problem in comparing result set values. Actually my store proc returns me the following resultset:
Month | Year | Deductible | Troop | TDC | ReasonCode
------------|-----------|-----------------|------------|-------------|--------------------------
January | 2008 | $100.0 | $0.0 | $0.0 | 1
------------|-----------|-----------------|------------|--------------|--------------------------
January | 2008 | $0.0 | $10.0 | $0.0 | 1
------------|-----------|---------------- |-------------|-------------|-------------------------
January | 2008 | $0.0 | $0.0 | $20.0 | 1
------------|-----------|-----------------|-------------|-------------|-------------------------
March | 2008 | $150.0 | $0.0 | $0.0 | 2
------------|-----------|-----------------|-------------|-------------|--------------------------
March | 2008 | $0.0 | $15.0 | $0.0 | 2
------------|-----------|-----------------|-------------|-------------|-------------------------
March | 2008 | $0.0 | $0.0 | $30.0 | 2
i will compare month and year fields. i.e if year is same the compare month and if month is same (e.g. January) the first three row of the above table will be clubbed in one row i.e.
Month | Year | Deductible | Troop | TDC | ReasonCode
------------|-----------|-----------------|------------|--------------|--------------------------
January | 2008 | $100.0 | $10.0 | $20.0 | 1
how can i do it in my result set?Learn SQL
"Select Month, Year, SUM(Deductible), SUM(Troop), SUM(TDC), ReasonCode from table Group By Month, Year, ReasonCode"Otherwise, loop through the resultset and compare the fields you want to compare using .equals() and sum the values yourself (of course). -
How to compare value before and after
hi,
one of the queried Values is the number of defective frames.Here, this value is compared with a previously sampled value
If now (after 10 s) this value is bigger than previous one ,then It saves new value otherwise loop will be continue.If again after (10s) the new value is bigger than previous new value then again saves this new point.how can i comapre value before and after?thanks.
TadhikaDo you know what a shift register is? It preserves a value from one loop iteration to the next. Please read the LabVIEW Help on shift registers. There's is also a simple example that ships with LabVIEW that will give you the basic idea (Help -> Find Examples).
You can also use a Feedback Node in lieu of a shift register. Same concept, different implementation. -
Hi,
I wondering how i can compare two values (integers) on a stack, i need to compare the top with the next to top. something like this:
if (compare(new Integer(m-i)) == compare(new Integer((m-i-1))))where compare is the name of the stack, i get the error message:
symbol : method compare (java.lang.Integer)
location: class CalcProb
i also tried
if (compare(m-i)) == compare(m-i-1)))but this doesnt work either.
If anyone can help that would be great!
Thanksnew Integer(m - i) versus new Integer(m - i -1)...
The integer values of the above would always be
different, because (m - 1) can never equal (m -
i
1), for any given 'm' value. Unless i is zero.No, it's (m - eye) versus (m - eye - one), not (m -
one) versus (m - eye - one), which (as you know) are
never equal for any given m and eye.I see where I typo'd in my original post, which led you to post the 'unless i is zero' reply. Sorry about that. -
Hi, i need to compare two value, one it comes to LeadSelection (nodePo_Items) and another comes other table (nodeTemp_GetdetailSerivce_Output), but the comparison <b>(if)</b> don't work.
ex:
int m = wdContext.nodeZbapi_Po_Getdetail_Input().nodeOutput_Po_Getdetail().nodePo_Items().getLeadSelection();
int n = wdContext.nodeTemp_GetdetailSerivce_Output().size();
for(int i = n - 1; i >= 0; --i)
<b>if </b>(wdContext.nodeTemp_GetdetailSerivce_Output().getTemp_GetdetailSerivce_OutputElementAt(<b>i</b>).<b>getPckg_No</b>() <b>==</b> wdContext.nodeZbapi_Po_Getdetail_Input().nodeOutput_Po_Getdetail().nodePo_Items().getPo_ItemsElementAt(<b>m</b>).<b>getPckg_No())</b>
wdContext.nodeTemp_GetdetailSerivce_Output().removeElement(wdContext.nodeTemp_GetdetailSerivce_Output().getElementAt(i));
<i>somebody knows that it can happen? I am comparing bad?</i>Hi Antonio,
I think the data type of your attribute Pckg_No is other than integer (like String, Bigdecimal or like an Object). Hence you cannot do a comparison using '=='.
Instead use 'equals' method.
wdContext.nodeTemp_GetdetailSerivce_Output().getTemp_GetdetailSerivce_OutputElementAt(i).getPckg_No().equals(wdContext.nodeZbapi_Po_Getdetail_Input().nodeOutput_Po_Getdetail().nodePo_Items().getPo_ItemsElementAt(m).getPckg_No()))
I think it will work.
Regards,
Shubham -
I must compare three values of a column in a select-statement:
column
a
b
c
=> a>b
=> b>c
L={a}
=> a before b
=> b before c
select x
from test
where CASE WHEN column=a > column=b THEN column=a ELSE when column=b > column=c THEN column=b END; ????
Does anybody have an idea?Here is a another new example, that will better explain my problem.
A department of my company needs only certain records
The specially exceptional rules (need for statistics) of our department are
=> senior manager (a) BEFORE escalation manager (b)
=> escalation manager (b) BEFORE support engineer(c)
When I get
SQL> select * from test order by 1,2,3
column_01 column_02 column_03
1 100 executive
2 200 executive
3 300 customer
4 4391 escalation manager
5 4391 senior manager
6 4391 support engineer
from the database I would like to have the following
SQL> select * from test
column_01 column_02 column_03
1 100 executive
2 200 executive
3 300 customer
5 4391 senior manager
And when I get
SQL> select * from test order by 1,2,3
column_01 column_02 column_03
1 100 executive
2 200 executive
3 300 customer
4 4391 escalation manager
5 4391 senior manager
6 4391 support engineer
7 5000 excalation manager
8 6000 customer
9 7134 escalation manager
10 7134 senior manager
11 7134 support engineer
12 8888 escalation manager
13 8888 support engineer
from the database I would like to have the following
SQL> select * from test
column_01 column_02 column_03
1 100 executive
2 200 executive
3 300 customer
5 4391 senior manager
7 5000 excalation manager
8 6000 customer
10 7134 senior manager
12 8888 escalation manager
column_01 = primary key
column_02 = foreign key
column_03 = kind of job
(For example it is possible that 7134 is working in three different companys
at different times).
regards,
mad -
Comparing value of bean property/textbox in a form to a field in the db
How do I compare the value of a bean property or the value of a textbox in a form (e.g. idno) to the value of an idno stored in my database using an SQL statement?
I actually know that my SQL statement should resemble something similar to the one shown below:
"SELECT * from user WHERE idno(value in the db) = idno(value entered in the form)"
My problem is I am placing this SELECT statement on a .java file so I am clueless as to how I will state, using an SQL statement, that I only want to retrieve the record whose idno in the db matches the idno entered by the user in the form (whose value I store in a bean that is also inside the .java file I mentioned earlier).
Should I place my SQL statement in the .java file or should I place it on my jsp instead?
Any advice will greatly be appreciated! Thanks in advance!Hi
Details:
JSP - Contains a Form for entering ID number.
Java Bean - Stores the ID number entered into the Form of the JSP page and also has the SQL Statement Object
The Problem: Where should you put the SQL Statement Object ?
Possible Solution: I think you are confused about SQL statements execution. This is what you can do. The Retrieved Id number from the Form has to be appended to the preformatted String which has the SQL statement stored in it. Once this is done this statement may be executed to retrieve the data associated with the ID number , if it exists.
Here is a link that should help you build an SQL statement on the fly and execute it. Try out some of the examples.
http://java.sun.com/docs/books/tutorial/jdbc/
Good Luck!
Eshwar Rao
Developer Technical Support
Sun mcirosystems inc
http://www.sun.com/developers/support -
Post Author: MTrusing
CA Forum: General
I am trying to compare returned values in my report so that I can identify duplicate records in our database. I have used the PreviousValue function before, but I don't believe that is what I need here. I'm wanting to compare each row in my report to the previous and next rows that are returned. Can anyone shed some light on this for me?Post Author: MTrusing
CA Forum: General
I am actually attempting to apply conditional formatting (shading all rows where a duplicate value exists). I have gone into Section Expert, and want to apply the formatting to the Detail section. Once I am in the Detail section of the Section Expert, where do I actually enter the formula to compare current field to previous values? When I type If {table.field} = Previous({table.field}), Crystal is looking for the formula result to either be a number, or it tells me it is looking for a "then". -
Dear all,
can we compare the values of one particular which is in two tables and then i want the data in quickview
while executing the quickview report(i have taken two tables).now i have to compare one particular field which is available in two tables
after comparing if the value of the that field is same in two tables;
similarity of that field in two tables data i require.
Please help me out in doing it.
Is there any facility in infoset query to compare.?Do an ordinary join in Quickviewer. Export the list to Excel. Excel offers far more options to analyse the data.
-
How do i compare value javascript variable with jsp variable
I have promblem .I have variable that store store the attribute value of column .The colum has more then one value.How to i compare with javascript value .Currently I am using the following method .
<%String sql_query3 = "SELECT DISTINCT (ir_tran_typ),ir_rea_desc "+
" FROM intrcd "+
" GROUP BY ir_tran_typ ";
System.out.println("trans type"+sql_query3 );
try{
rset = db.execSQL(sql_query3);
catch(SQLException e) {
System.err.println("Error in query - intrcd - transaction_main.jsp " +e +" sql " +sql_query3);
while(rset.next()== true){
tran_cde = rset.getString("ir_tran_typ");
rea_desc = rset.getString("ir_rea_desc");%>
<%System.out.println("trans type 34 "+tran_cde );%>
//tran_typ = addElement('<%=tran_cde%>');
<% }%>
if(obj.value== '<%=tran_cde%>' ){
<% String sql_query2 = "SELECT ir_rea_cde,ir_rea_desc"+
" FROM intrcd"+
" WHERE ir_tran_typ = '"+tran_cde+"' " +
" ORDER BY ir_rea_cde ";
System.out.println("trans type"+ tran_cde);
try{
rset = db.execSQL(sql_query2);
catch(SQLException e) {
System.err.println("Error in query - emmast2 - transaction_main.jsp " +e +" sql " +sql_query2);
index = 1;
while(rset.next()== true){%>
document.all.rea_cde.options[<%=index%>] = new Option(eval('"<%=rset.getString("ir_rea_cde")%>"'));
document.all.rea_cde.options[<%=index%>].value = eval('"<%=rset.getString("ir_rea_cde")%>"');
document.all.rea_cde.options[<%=index%>].text = eval('"<%=rset.getString("ir_rea_desc")%>"');
<% index++;
}%>
please replay me soon
thank you.javascript and java do not mix.
Java code runs, and produces HTML/javascript.
Java code stops running.
The page loads in the browser, and it starts up javascript.
Javascript cannot talk to java and vice versa.
Your JSP can generate javascript code onto the page to be executed on the client, but they never directly communicate.
please replay me soongame over dude ;-)
Maybe you are looking for
-
Apex 3.1.2 Development Environment typo
<ol> <li>On the Report Attributes tab of a report...</li> <li>in the Layout and Pagination section...</li> <li>the field label "Report Attributes Substituion"</li> </ol> I'm thinking there's a 't' missing there. Yet how many times have we all gl
-
Multiple records of table from RFC to XI in single XML file
Hi My Scenario is as following --> <b>RFC ---> Sender RFC Adapter ---> XI - > Rec SOAP adapter ---> Web Service</b> Now we need multiple records from RFC which can be put in single XML file & XI can transport the whole XML file to Web Service. All th
-
Work Repository creation - Error
hi, I have cretaed Master Repository successfully but while creating Work Repository, getting following error Name : Work_Repository Technology: Oracle instance/dblink (Data Server): (empty) username: snpw (I have created this user) password: snpw JD
-
Trouble converting movies into ipod compatible files
I just got quicktime pro and I'm trying to convert movie files into files that can be played on my ipod... the files are changing into M4V files and can be played on my ipod but they have no sound.. can anyone help me fix this?
-
MM Certification queastion/exam model version ECC5.0
Hi, I am writing MM certification exam on ECC5.0 version on this month end. Can anybody just guide us about the exam model questions. Sample questions. As I am writing in version ECC5.0, will that be different than person writing with 4.7 version? Wa