Compare records

Hi,
   This is very urgent, i need to compare two records of an internal table and then add one counter to it.
like
Filed1               Field2
A                         100
A                         200
B                         300
C                         400
Now i have to set a counter for field1 and for A the value of the counter would be 2. For B and C it would be 1. Can you suggest how to do that? It is really urgent.

hi,
You must already have a counter by different value that you have in the table or you know what king of value you will have?
you can sort you table by A and use the event AT :
AT - itab
Syntax
LOOP AT itab result ...
  [AT FIRST.
   ENDAT.]
    [AT NEW comp1.
     ENDAT.
       [AT NEW comp2.
       ENDAT.
       AT END OF comp2.
       ENDAT.]
     AT END OF comp1.
     ENDAT.]
  [AT LAST.
  ENDAT.]
ENDLOOP.
and then do the same thing with sorting by B.
Regards

Similar Messages

  • How to compare records in singe internal table

    Hi Folks,
    iam having 3 records in my first itab( T_FINAL) with fields
    material no,  descrip ,  mat type and  group.
    and 16 records in second itab(T_MVKE ) with fields
    mat no ,  distri.chanel  and division
    now I want to fetch the records from T_MVKE  by comparing the records in
    T_FINAL .my requirement is to check the given mat no. in sales org.2000,2100.  if yes then i have to consider 2000 only, if it is in only 2100 then consider 2100 only . is it is in 2000 only then consider 2100 only
    my code is
    LOOP AT T_FINAL.
        READ TABLE T_MVKE WITH KEY MATNR = T_FINAL-MATNR.
       IF SY-SUBRC = 0.
       ON CHANGE OF T_MVKE-MATNR OR T_MVKE-VKORG.
    IF T_MVKE-VKORG = '2000' and SY-TABIX > 1.
          CONCATENATE '2000' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
    ELSEIF T_MVKE-VKORG = '2000' AND SY-TABIX = 1.
         CONCATENATE '2000' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
    ELSE.
        CONCATENATE '2100' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
        ENDIF.
    this logic fails ,. could tell me how to compare values in single itab?
    Thanks
    neha

    Hi ,
    if i've understand you correctly , try that:
    LOOP AT t_final.
      AT NEW matnr.
        CLEAR: v_2000, v_2100.
    *1) 2000
        READ TABLE  t_mvke    WITH KEY matnr = t_final-matnr
                                       vkorg = 2000.
        IF sy-subrc = 0.
          v_2000 = 'X'.
        ENDIF.
    *2) 2100
        READ TABLE  t_mvke    WITH KEY matnr = t_final-matnr
                                       vkorg = 2100.
        IF sy-subrc = 0.
          v_2100 = 'X'.
        ENDIF.
    *compare
        IF v_2000 = 'X' AND  v_2100 = 'X'.
    *read 2000 only
        ELSEIF v_2000 = ' '  AND v_2100 = ' '.
    *nothing found
        ELSE.
    *all other combinations
    *read 2100 only
        ENDIF.
      ENDAT.
    ENDLOOP.
    regards Andreas

  • Compare records in a FORM with that in an Excel file

    Guys,
    As part of automating a Payroll process I need to compare the records on an Oracle FORM to that in an external Excel file. There are multiple columns that need to be compared. Does anyone have a sample ATS Java script to do this that I can refer to? I am using the external file as a databank.
    Thanks,
    Murali.

    Murali,
    For each part of your Oracle Form -- set a variable, this is often done for you during record. Since you are doing text matching -- add a text matching test for each place on the form that you want to check against your excel file.
    Personally, I'd save it as a csv. But I suppose it will work as an xls.
    Then just name the columns of your excel sheet to be the same as the name of the variables you are looking for on the Oracle form.
    You shouldn't have to do any coding to make this happen, its all built in oats functionality. You should be able to do all of this stuff from OFT or openscript.
    Once you have that -- you'll need to set the test to iterate smoothly -- which means having the last step of your RUN section return you to the same page as the first step of the RUN section.
    Then just set your test to iterate however many rows of the databank you want and you'll be going through and comparing each row of data to the information returned by the oracle form.
    For instance --
    You are looking up a customer by cust_id and you will get address (add1), name (name), phone number (phone) back and want to make sure these are all correct.
    Your data bank will look like this:
    cust_id, add1, name, phone
    1234, 100 Main St, John Doe, 800-555-1212
    5678, 200 5th Ave, Suzie Queue, 800-555-1234
    Your test steps will look like this (they are not exact)
    Step 1) Go to the start of the Oracle Form
    Step 2) Select the Form section to enter the Cust_ID {variable to get Cust_ID from databank} Enter the 1st Cust_Id from the databank
    Step 3) Get additional information for the specific Cust_ID from the Form
    Step 4) Select the Address and do a text matching case {variable to get Add1 from databank}
    Step 5) Select the Name and do a text matching case {variable to get Name from databank}
    Step 6) Select the Phone # and do a text matching case {variable to get Phone # from databank}
    Step 7) Pass test and enter message indicating that {variable to get Cust_Id from databank} is all correct
    Step 8) Return to the start of the Oracle Form
    I hope this is helpful.
    --tiff                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Addressing/comparing record data in a .ctl file.

    Unfortunatly I am importing a flat file with data redundancy. I would like to dedup this data during the load. Below is the portion of the .ctl file I am unable to get working. The issue is in bold, SQL*LOADER does not like the position to position comparison. I have tried the bind method as well, but no luck.
    Please let me know how I can compare two strings within the same record for a SQL*LOADER control file..
    Agent #1 ID is positions 135-139 and Agent #2 ID is positions 964-968. Agent #1 always gets loaded ( based on the other portions of the WHEN clause ). Agent #2 should not get loaded if this is the same agent ID as Agent #1.
    --Agent #1
    INTO TABLE myschema.Agent
    WHEN ( 1489     :      1490 )='04' and ( 1491 : 1492 )='02' and ( 135     :      139 ) != '00000'
         AGENT_NO POSITION( 135     :      139 ) "TRIM(:AGENT_NO)",
         CASE_NO POSITION( 1          :      10 ) "TRIM(:CASE_NO)"
    Agent #2 If Not the same As agent 1
    INTO TABLE myschema.Agent
    WHEN ( 1489     : 1490 ) = '04' AND
         ( 1491 : 1492 ) = '02' AND
         ( 964 : 968 ) != '00000' AND      
          ( 135 : 139 ) != ( 964 : 968 )
         AGENT_NO POSITION( 964 : 968 ) "TRIM(:AGENT_NO)",
         CASE_NO POSITION( 1     :      10 ) "TRIM(:CASE_NO)"
    )

    Got it!
    Thank you very much !
    -Pamsath

  • Comparing Records Question

    I have created a record:
    TYPE for_list is table of varchar2(4000) index by binary_integer;
    TYPE for_loop_state is record (
    list for_list,
    next_index integer
    I would like to create procedure that has stores the values of the previous record into another record. Each time this new procedure is accessed, I would like to compare the contents of both records to determine if they are different. Based of that knowledge I would like to discard the contents of the first record.
    I also would like to be able to somehow uniquely distinguish the contents of the second record from the first one, by adding a counter or something. I would like to have some input on how I should go about doing that.
    Is this a feasible idea, or should I pursue another direction?
    Thx

    I have a procedure that is processing steps, the procedure will generates msgs that will be sent to the client (browser, ivrs) based on the ui_type (WEB, IVR, Remote). This procedure will loop over each step to build msgs until no more steps are found.
    If it encounters what we call a 'for' step then it executes another procedure that checks the state of the list that is defined in a record. If it exists then it then iterates to the next item in the list to generate a msg to be sent back to the client.
    My problem is that I have list variables that have the same name, and when I encounter the same name in my program I want to discard/reinitialize the contents of that list.
    I am trying to determine an efficient and quick way to go about it.
    CODE EXAMPLE:
    TYPE for_list is table of varchar2(4000) index by binary_integer;
    TYPE for_loop_state is record (
    list for_list,
    next_index integer
    TYPE for_loops_list is table of for_loop_state index by steps.output_param%TYPE;
    all_for_loops for_loops_list;
    procedure for_step(list_string IN varchar2, ret_var_name IN varchar2, end_for_label IN varchar2) is
    state for_loop_state;
    end_idx number;
    list_value varchar2(4000);
    begin
    -- get the current for list state, based on its output variable name
    if all_for_loops.exists(ret_var_name) then
    state := all_for_loops(ret_var_name);
    else
    state.next_index := 0;
    list_value := parse_next_param(list_string, 1, end_idx);
    -- end_idx is thrown away; for loops only have 1 input parameter (the list)
    state.list := get_for_list(list_value);
    all_for_loops(ret_var_name) := state;
    end if;
    if state.next_index < state.list.count then
    pkg_session_values.put(ret_var_name, state.list(state.next_index));
    all_for_loops(ret_var_name).next_index := state.next_index + 1;
    else
    all_for_loops.delete(ret_var_name);
    jump(end_for_label);
    end if;
    end;

  • Comparing records in tables and displaying them

    Hi,
    I have 2 sets of data as follows:
    Set 1
    AcctName |EffDt |     ExpDt|     BalAmt|     Status|
    ABC|     1-Jan-11|     31-Dec-11|     47500|     Active|
    DEF|     5-Jul-11|     4-Jul-12|     46204|     Active|
    GHZ|     5-Feb-11|     4-Feb-12|     43251|     Active|
    Set 2
    AcctName | EffDt | ExpDt| BalAmt | Status|
    ABC | 2 Jan 2010 | 1 Jan 2011 | 47500 | Exp|
    XYZ | 5 Dec 2010 | 3 Dec 2011 | 46564 | Exp|
    ABC | 11 Nov 2010| 10 Nov 2011 | 40142 | Exp|
    I want to compare the set 2 data with set 1 data.
    I need to get an output such that:
    if there exists an Acct with same name and the ExpDt is equal to the Effdt then, the output should be the union of set 1 and set 2 and should not contain the that matching acct from set 2 since there exists a nonzero balanced latest Acct -
    AcctName| EffDt | ExpDt | BalAmt | Status|
    ABC | 1 Jan 2011 | 31 Dec 2011 | 47500 | Act|
    DEF | 5 Jul 2011 | 4 Jul 2012 | 46204 | Act|
    XYZ | 5 Dec 2010 | 3 Dec 2011 | 46564 | Exp|
    GHZ | 5 Feb 2011 | 4 Feb 2012 | 43251 | Act |
    ABC | 11 Nov 2010 | 10 Nov 2011 | 40142 | Exp|
    Can you please help me in comparing these sets and get the desired output?
    Note: Column Names
    AcctName -> Account Name
    EffDt -> Effective Date
    ExpDt -> Expiry Date
    BalAmt -> Balance Amount
    Thanks & Regards,
    869467

    Thanks for the reply.
    Please find the scripts for table creation & insertions below-
    create table set1(AcctName VARCHAR2(50), EffDt DATE, ExpDt DATE, BalAmt NUMBER(10), Status VARCHAR2(10));
    insert into set1 values('ABC','1 Jan 2011','31 Dec 2011',47500,'Active');
    insert into set1 values('DEF','5 Jul 2011','4 Jul 2012',46204,'Active');
    insert into set1 values('GHZ','5 Feb 2011','4 Feb 2012',43251,'Active');
    create table set2(AcctName VARCHAR2(50), EffDt DATE, ExpDt DATE, BalAmt NUMBER(10), Status VARCHAR2(10));
    insert into set2 values('ABC','2 Jan 2010','31 Dec 2011',47500,'Active');
    insert into set2 values('XYZ','5 Dec 2010','4 Dec 2011',46564,'Active');
    insert into set2 values('ABC','11 Nov 2010','10 Nov 2011',40142,'Active');
    Yes I need the output in almost the same way.
    The output should not contain those accts records from set 2 where there exists a record for it in set1 on the expiry date of that acct.
    Thanks & Regards,
    869467

  • How to compare record count of two tables?

    Hi,
    i am in need of simple sql script where i can compare two table record count.
    i have something like below:
    (select count(*) from table1) minus (select count(*) from table2)
    now the problem is if the table1 count greater then table2 count the output is fine.
    If the table2 record count is more then i am getting zero as the output.
    how can i get the difference in two tables record count?
    Thanks a lot in advance.
    --Raman.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Doing a MINUS between the counts does not yield the diff.
    e.g. if table A has 100 records and table B has 70 records then,
    SELECT count(*) FROM A
    minus
    SELECT count(*) from B
    will give 100 and not 30.
    Try this:
    SELECT (
    CASE WHEN ((select count(*) cnt from A) - (select count(*) cnt from B)) <0
    THEN ((select count(*) cnt from A) - (select count(*) cnt from B))* -1
    ELSE ((select count(*) cnt from A) - (select count(*) cnt from B)) END) Difference
    FROM dualor this is simpler
    SELECT abs(((select count(*) cnt from A) - (select count(*) cnt from B))) difference FROM dualEdited by: Caitanya on Jan 9, 2009 7:12 AM
    Applied abs function after seeing BluShadow's post :)

  • Compare records fields?

    Hi,
    i have one requirement in the report. My user will select only 2 records from contacts at any time to run the report. Before executing the report it has to do some validation. If the validation matches then execute report. Otherwise report should say message proper matched field records not exist.
    for example.
    1) i have 1st record with data like this in one record
    contact name = test
    contact Phone = 000
    contact comments = xyz
    2) i have 1st record with data like this in one record
    contact name = test
    contact Phone = 000
    contact comments = 123
    in above records different is contact comments
    then report should execute.
    if suppose
    a) i have 1st record with data like this in one record
    contact name = test
    contact Phone = 000
    contact comments = xyz
    b) i have 1st record with data like this in one record
    contact name = test222
    contact Phone = 000
    contact comments = 123
    then report should say please select proper record with proper data message. At any time contact name and contact Phone should match.
    i have loop like this
    <?for-each-group:Contact[position()='1'];./ContactName?><?sort:current-group()/ContactName;'ascending';data-type='text'?>
    where to compare and write condition?
    Thanks,
    Anu
    Edited by: user7498756 on Sep 6, 2012 3:27 PM

    okay i have contact table. it contains several records. But user will select only two records at any time.
    once user select two records on contact, i have to compare 1st record fields with 2nd record fields. I explained the field with data in my posting. Hope you understand what i am asking?
    let me know if you need more clearly..
    Thanks,
    Anu

  • How to compare records in the same table?

    I have a table of course registrations.  I would like to select course registrations as of a certain date that do not have a dropped status against it.
    CREATE TABLE REGISTRATIONS
    (ID VARCHAR(7) ,
    COURSE VARCHAR(4),
    CURRENT_STATUS VARCHAR(10),
    STATUS_DATE VARCHAR(10))
    INSERT INTO REGISTRATIONS
    (ID, COURSE, CURRENT_STATUS, STATUS_DATE)
    VALUES
    ('1111111','ADMN', 'REGISTERED', '2014-04-10'),
    ('1111111','MATH', 'REGISTERED', '2014-04-10'),
    ('1111111','ADMN', 'DROPPED', '2014-04-10'),
    ('1111111','MATH', 'DROPPED', '2014-04-12'),
    ('1111111','BIOL', 'REGISTERED', '2014-04-10')
    SELECT * FROM REGISTRATIONS
    ORDER BY COURSE, CURRENT_STATUS
    drop table REGISTRATIONS
    ID COURSE CURRENT_STATUS STATUS_DATE
    1111111 ADMN DROPPED 2014-04-10
    1111111 ADMN REGISTERED 2014-04-10
    1111111 BIOL REGISTERED 2014-04-10
    1111111 MATH DROPPED 2014-04-12
    1111111 MATH REGISTERED 2014-04-10
    The above example shows that ID '1111111' has registered for ADMN and BIOL on April 10th but dropped ADMN the same day.  It also shows that they registered for MATH on April 10th but dropped it on the 12th.
    If I were to select course registrations to date as of April 10 I would see both ADMN records, BIOL and MATH.  BIOL and MATH would be OK but I don't want to see the ADMN data in the result because they have essentially cancelled themselves out. 
    In saying that, how do I write a script to select all course registrations as of a certain date but omit the ones that have been dropped at anytime before the select date?

    check below,
    SELECT * FROM REGISTRATIONS a
    WHERE CURRENT_STATUS <> 'DROPPED' AND STATUS_DATE <= '2014-04-12'
    AND COURSE NOT IN (
    SELECT COURSE FROM REGISTRATIONS
    WHERE CURRENT_STATUS = 'DROPPED' AND STATUS_DATE <= '2014-04-12')
    ORDER BY a.COURSE, a.CURRENT_STATUS

  • Comparing Records

    Post Author: Skip
    CA Forum: Formula
    I need to distinguish the number of incidents for a type of leave.  Each entry for the ID is one day.  Each incident can be up to 5 consecutive days. Great than 5 days counts as another incident.
    I have a formula that compares and returns a value of 1 or 0 that I use in excel.  I want to accomplish the same thing with a formula in Crystal.
    Here is the Excel formula =IF(AND(A3=A2,B3-B2<5),0,1)
    Here is the data
    ID
    Time Date
    Sum Hours
    01041
    2006-04-19
    11.25
    1
    01041
    2006-04-20
    11.25
    0
    01403
    2006-06-28
    11.25
    1
    01403
    2006-06-29
    11.25
    0
    01671
    2006-04-26
    7.5
    1
    01671
    2006-04-27
    7.5
    0
    01671
    2006-04-28
    7.5
    0
    01671
    2006-09-18
    7.5
    1
    01671
    2006-09-19
    7.5
    0
    01671
    2006-09-20
    7.5
    0
    01893
    2007-03-14
    7.5
    1
    01893
    2007-03-15
    7.5
    0
    01893
    2007-03-16
    7.5
    0
    Any help would be greatly appreciated.
    Thanks

    Post Author: bettername
    CA Forum: Formula
    If simply inserting a summary on the formula doesn't work, then add these extra group header/footer formulas, and change the formula in your details section to:
    In group header (new, suppress):
    whileprintingrecords;
    numbervar counter:=0;
    In details (change from existing, don't suppress as it shows the 1 and 0):
    whileprintingrecords;
    numbervar counter;
    numbervar total;
    if RecordNumber=1 then (counter:=counter1;total:=total1;1;)elseif {Command.id} <> previous({Command.id}) then (counter:=counter1;total:=total1;1;)else(if abs(datediff("d",{Command.thedate}, previous({Command.thedate})))<5 then (counter:=counter; 0) else (counter:=counter1;total:=total1;1))
    In Group footer (new, don't suppress):
    whileprintingrecords;
    numbervar counter;
    In Report Footer (new, don't suppress):
    whileprintingrecords;
    numbervar total;

  • How can i compare two excel files with different no. of records.

    Hi
    I am on to a small project that involves us to compare two excel files. i am able to do it but am struck up at a point. When i compare 2 different .csv files with different no. of lines i am only able to compare upto a point till when the number of lines is same in both the files.
    Eg. if source file has 8 lines and target file has 12 lines. The difference is displayed only till 8 lines and the remaining 4 lines in source lines are not shown.
    Can you help me in displaying those extra 4 lines in source file. I am attaching my code snippet below..
    while (((strLine = br.readLine()) != null) && ((strLine1 = br1.readLine())) != null)
                     String delims = "[;,\t,,,|]";
                    String[] tokens = strLine.split(delims);
                    String[] tokens1 = strLine1.split(delims);
                   if (tokens.length > tokens1.length)
                    for (int i = 0; i < tokens.length; i++) {
                        try {
                            if (!tokens.equals(tokens1[i])) {
    System.out.println(tokens[i] + "<----->" + tokens1[i]);
    out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + tokens1[i]);
    out.println();
    sno++;
    } catch (Exception exception)
    out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + "");
    out.println();
    Thanks & Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    A CSV file is not an Excel file.
    But apart from that your logic makes no sense.
    If the 2 files are of different sizes the files are different by definition, so further comparison isn't needed, you're done.
    If you want to compare individual records, you need to compare all records from one file with all records from the other, unless the order of records is important in which case your current system might work.
    That system however is overly complicated for comparing CSV files.
    As you assume a single record per line, and if one can assume those records to have identical layout (so no leading or trailing whitespace in or between columns in one file that's not in the other) comparing records is simply a matter of comparing the entire lines.

  • Verifying if the records already exists

    I am trying to add a new record to an existing array but I would like to verify if the a new record to be added already exists in the array then it should not add it and instead alert the user on the monitor.
    The following is part of my code which is inside my addmenu method. I have tried to run and execute my code but whenever I enter two identical records it adds both the records so I know there is something wrong with the for loop and if statement.(record[] array is where all the information is being stored and I created a hold[] for temporary storage.)
    Thanks and highly appreciate your help
    Jose Armando
    static void addmenu()throws IOException {
         System.out.println("Enter the last name");
         String LN = keyboard.readLine();
         System.out.println("Enter the first name");
         String FN = keyboard.readLine();
         System.out.println("Enter the exam mark");
         double EM = Double.parseDouble(keyboard.readLine());
         System.out.println("Enter the test mark");
         double TM = Double.parseDouble(keyboard.readLine());
         System.out.println("Enter the assignment mark");
         double AM = Double.parseDouble(keyboard.readLine());
         System.out.println(LN+" "+FN+" "+EM+" "+TM+" "+AM);
         System.out.println("If this record to be added is correct then type Y otherwise type N");
         String confirm = keyboard.readLine();
         for (int i=0;i<=index;i++){
         if (confirm.equalsIgnoreCase("Y")) {
         hold[0]=new Student(LN,FN,EM,TM,AM);}
         else {System.out.println("Please enter the record again");
              addmenu();}
         if(record==hold[0]){
         System.out.println("The information to be added already exists.Please enter again");
                   addmenu();//close for
         }//CLOSE IF
         else { record[index++]=hold[0];
              printSort("After Adding new student");
    }//close else
    }//close for
    }//close addmenu

    Hey, what's going on? It's embarassing.
    I can't see my correction for second time.
    Just in words: try to put "i " in square brackets after your "record" in line where you compare record and hold with 0 in square brackets.
    Regards

  • Present a record by date through an Abap Rutine

    Hi Gurus,
    i got in the cube the next records for example:
    calday Material Quantity
    01.01.2011 A 10
    15.01.2011 A 20
    if i present in the query these IO an KF the query will show these 2 records, now i want just show the last record by date
    calday Material Quantity
    15.01.2011 A 20
    i tried in the query with a calculate KF with exception aggregation , MAX with Reference to calday , but, i need to show 0CALDAY for that reason this doesnt work, so i was thinking in an ABAP  rutine that read all the active table of the ODS and compare record by record whats the last date by material and this record must be marked with a vaalue in another Infoobject, before the load to the cube, then i filter in the query for this mark IO, now how will the code be? can you help  to build this code, or some advice or idea?,  i appreciate it

    Thanks for helping me.
    Currently, my application provides users a feature to sort all the ThreadBean retrieved from the database according to two criteria:
    1. sort by
    thread_last_post_date, thread_creation_date, message_sender, thread_reply_count, thread_view_count
    2. order by DESC or ASC
    Therefore, my existing query string looks like:
    String query = "SELECT ...... FROM message_thread WHERE message_receiver = ? ORDER BY " + sort + " " + order;According to your advice, I simply add another criterion; say, articleTitle to my query string.
    A. Will this added criterion articleTitle have any impact on the feature that the application provides to users; namely, sort and order? (Now, all messages will be presented to users in categories; i.e. articleTitle.)
    B. Where should I add the articleTitle to the query string
    B.1: before sort and order?
    String query = "SELECT ...... FROM message_thread WHERE message_receiver = ? ORDER BY " + articleTitle + " " + sort + " " + order;or
    B.2: after sort and order?
    String query = "SELECT ...... FROM message_thread WHERE message_receiver = ? ORDER BY " + sort + " " + order + " " + articleTitle;

  • Need Sorter java  file   for sorting the records in webdynpro java

    Hi  Gurus
       I  had urgent requirement please give your inputs
       In my webdynpro java i need to sort entire records in table
       I now we need One sorter java class please provide that java file
       please suggest the all the steps how  to do
    Thanks
    renu.

    1. Implement class comparator wich will compare records according your sort preferencies,
    like this:
         public class record_Comparator implements Comparator{
              public int compare(Object emp1, Object emp2){
          // here is your code for return -1if 'before'  or 0 if equal or 1if 'after'
                   int stepId_1 = ((record)emp1).get_someValue();       
                   int stepId_2 = ((record)emp2).get_someValue();
                   if(stepId_1 > stepId_2)
                        return 1;
                   else if(stepId_1 < stepId_2)
                        return -1;
                   else
                        return 0;   
    than call method sort() with your collection of records,
    like this:
    Collections.sort(record_collection, new record_Comparator());

  • Re: Apex 3.0 Insert Function Works, but records can't be found

    i have an existing application that I created with Apex 3.0. It allows users to search for records using several different criteria and it allows them to update records.
    I added functionality that allows the user to insert a new record. The insert allows user to populate a dozen fields,. Behind the scenes it uses triggers to get the next value for the key and to set the update time stamp and user id. It also sets a flag that is used in the select query.
    The insert works fine. Whenever I add a record, I can view it using SQL developer.
    However if I try to search for a record that was inserted using the application, the application never finds the record.
    In SQL developer I run the same query that application runs. I always get the records that were added.
    If I compare records that were added by using the application with existing records on the table, the data looks similar.
    Any thoughts ?
    thanks
    Edited by: 975204 on Mar 29, 2013 1:22 PM
    Edited by: 975204 on Mar 29, 2013 1:23 PM

    yep
    I got it working that way
    The select query allows users to enter search criteria into text boxes. It also allows them to select a field from a list of values
    (lower(lastname) like '%' || lower(:P5_NAME) || '%')
    AND (lower(address) like '%' || lower(:P5_ADDRESS) || '%')
    AND (lower(title) like '%' || lower(:P5_TITLE) || '%')
    AND (lower(phone) like '%' || lower(:P5_PHONE) || '%')
    AND deptNo = decode(:P5_DEPT,'%null%',TRIM(lvl01),:P5_DEPT)
    I took these apart and tried the search criteria separately
    What I discovered was that for the list of values I had to add "or is Null"
    (lower(lastname) like '%' || lower(:P5_NAME) || '%')
    AND (lower(address) like '%' || lower(:P5_ADDRESS) || '%')
    AND (lower(title) like '%' || lower(:P5_TITLE) || '%')
    AND (lower(phone) like '%' || lower(:P5_PHONE) || '%')
    AND (deptNo = decode(:P5_DEPT,'%null%',TRIM(lvl01),:P5_DEPT)
    or deptNo is null)
    It works fine now, thanks

Maybe you are looking for