Accessing and comparing rows from resultset

Post Author: pross
CA Forum: Formula
I am a newbie, and this might be a simple answer ( I hope so)
I would like to compare rows inside my result set. For example, if I recieve information such as:
CUSTOMER:12345 AMOUNT:100.00 CUSTOMER:12345 AMOUNT(100.00) CUSTOMER:2345 AMOUNT:75.00 CUSTOMER:4567 AMOUNT:25.00
I want to be able match the same customer number and amounts that balance out [ 100.00 and (100.00)], to not show in my report.
How can I do this?
Thanks                    

Post Author: pross
CA Forum: Formula
I am returning rows that match my criteria. Because of the way the data is stored, it shows a record that has a positive value (a charge) and a negative value for the same criteria (a payment). I want to only show records that do not have a negative value, as well as the record that shows the charge for that record. For instance I want to be able to match everything in my row as well as the amounts from those two rows sum to 0. I am not sure how to do this in a sql query or be able to filter it out in CR.

Similar Messages

  • Can i count row from ResultSet ?

    I would like to count row from ResultSet for
    take it into my array object because i must know number of row before create array object.
    Example:
    ResultSet rset = stmt.executeQuery("select * from user ");
    /*i = amount of ResultSet*/
    User[] user = new User;
    int l=0;
    while (rset.next()){
    user[l] = new User();
    user.name = rset.getString(1);
    l++;

    Hi,
    As per my knowledge there is no method by which you can get the count of items in a resultset directly. You will have to loop through the reseltset and set a variable for count. In your specific case I would advise you to use a Vetor instead of an array so that you need not bother about the size.
    ResultSet rset = stmt.executeQuery("select * from user ");
    Vector user = new Vector();
    while (rset.next()){
    user.addElement(rset.getString(1));
    Now you will have a Vector that holds the user info. To retrieve the user info loop through the Vector.
    for (int i; i<user.size(); i++){
    userName = user.elementAt(i);
    Hope I was of some help.
    cheers!!!
    Nish

  • How do I access and delete photos from Photo Stream

    I am using Yosemite 10.10.3.  Apple TV (3rd gen) screen saver shows older photos that I have deleted from the photos program but are apparently still in Photo Stream.  How do I access and delete these from Photo Stream?
    Thanks

    Hello winim64,
    After reviewing your post, it sounds like you want to delete photos from My Photo Stream. I would recommend that you read this article, it may be able to help the issue.
    Delete photos from My Photo Stream - Apple Support
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Need quick TIP: remove "Copy access and configuration settings" from added package

    I added a modified package in APPVMAN with the option "Copy access and configuration settings".
    Package is unpublished. But shows AD groups as a current package because I used the option "Copy access and configuration settings"
    QUESTION:
    How to Remove (and then add) the option "Copy access and configuration settings" from added package.
    Cannot find it.
    Thanks.
    --- When you hit a wrong note its the next note that makes it good or bad. --- Miles Davis

    sorry for the panic :)
    before publishing an updated package to existing groups of initial package I hit the option
    "Copy access and configuration settings".
    But first I wanted to test it for TEST group. Didn't think that AD settings will be applied (do it first time).
    Just to confirm:
    1. I will remove current groups from updated(unpublished package)
    2. Will add Test group and test the package.
    3  In case it is OK I can then add removed(needed) groups.
    I want to be sure that after removing and adding needed groups all other settings will be intact.
    Thanks.
    --- When you hit a wrong note its the next note that makes it good or bad. --- Miles Davis

  • Random Row From ResultSet

    Hi, i need some help on this:
    First, my JSP will query a database table and return a resultset that contains a lot of records. Is there a way to randomly choose ONE of the record from resultset ?
    Number of records return by the resultset is dynamic (always change), so, is there a way to store all the records into array first?
    Or do you have any other suggestions ?
    Thank you !

    Better way is to create a Bean for the row returned by the Result Set. For example your result set return 2 columns i.e. ID and Name then your bean should have getter and setter methods for the columns and repeating the loop for the Result set store each returned row in the bean and then store this bean in the Collection. This is better way to work with it.

  • Retrieving the entire row from ResultSet

    Hi All,
    I am using SQL database and wants to get the data from tables as rows instead of columns. Please let me know if any of you know how to retrieve the rows from table using ResultSet.
    Thanks.

    you would need a loop like this:
    for( int i = 0; i < resultset.getMetadata().getColumnCount(); i++ )
      System.out.print( resultSet.getXXX( i ) );
    }That will print out the row

  • Help :add multiple rows from Resultset to ArrayList ?

    My query returns one column and multiple rows. In Java code , I am trying to get this data in array or arraylist through ResultSet
    ex:
    item_num
    p001
    p002
    p003
    when I print, it only gets the item in the first row.
    ArrayList myArrayList = new ArrayList();
    resultset = preparedstatement.executeQuery();
    if (resultset.next())
    myArrayList.add(new String(resultset.getString("item_num")));
    Print:
    for (int j = 0 ; j < myArrayList.size() ; j++ )
    System.out.println((String)myArrayList.get(j)); --this prints only the first item.
    can someone assist ?

    changing if to while fixed it.

  • How to read 'clicked header' AND selected row from multicolumn listbox?

    I have a multicolumn listbox filled with 6 columns and about 500 rows.
    I want the user to be able to click on a column header, and sort the listbox alphabetically on that column. I've written the code for that, and that works. (using the 'itemnames' en 'get clicked col hdr' properties.)
    However, I also want to include the option, that when a user highlights a row, and then clicks on the header, that after the listbox gets sorted it scrolls down to the selected row.
    (So that the user doesn't have to search for it)
    And that's where things go wrong, because the value of the listbox changes to zero when you click on a column header. No I idea why it does that, but it's rather
    annoying. Can I change that behaviour somehow?
    Or any ideas how to get around it?

    My thanks to you and Jared.
    Seems I got a working solution now.
    Did take a while to figure out why your solution worked. Basicly, you're reading the row from a few iterations before.
    As soon as I understood that, I simplified it a little. Look at the attached file... I think it does the same. :-)
    Jared asked for the sorting routine. As I don't seem to be able to attach files when replying to comments, I took the liberty to include it here also.
    Basicly, I just use the 'sort 1D array' that comes with Labview 6. To be able to sort a 2D array, I convert every row to a cluster. That's something the 'sort 1D array' VI can handle nicely.
    To sort on the correct column, I just cut all columns in front, and paste them behind again. A
    fter sorting, I reverse the process.
    Anthony.
    Attachments:
    copy2_of_multicolumn.vi ‏26 KB
    sort_2d_string_array.vi ‏34 KB

  • Removing Duplicate Rows from resultSet

    I have a query pulling data from 5 tables in 12 columns. I have rows where all of the data is duplicated with the exception of one date column. How would I go about deleting rows that are duplicates with the exception of this one column? I still need to pull the date from the date column with the Max(date).
    i.e.
    Bob Smith 1 2 3 4 12-Jul-2006
    Bob Smith 1 2 3 4 02-Aug-2006
    Bob Smith 1 2 3 4 21-Jan-2006
    Form this resultset I only want one row
    Thanks.

    this example might be of help.
    SQL> select * from employees;
    YEAR EM NAME       PO
    2001 02 Scott      91
    2001 02 Scott      01
    2001 02 Scott      07
    2001 03 Tom        81
    2001 03 Tom        84
    2001 03 Tom        87
    6 rows selected.
    SQL> select year, empcode, name, position,
      2         row_number() over (partition by year, empcode, name
      3                            order by year, empcode, name, position) as rn
      4    from employees;
    YEAR EM NAME       PO         RN
    2001 02 Scott      01          1
    2001 02 Scott      07          2
    2001 02 Scott      91          3
    2001 03 Tom        81          1
    2001 03 Tom        84          2
    2001 03 Tom        87          3
    6 rows selected.
    SQL> Select year, empcode, name, position
      2    From (Select year, empcode, name, position,
      3                 row_number() over (partition by year, empcode, name
      4                                    order by year, empcode, name, position) as rn
      5            From employees) emp
      6   Where rn = 1;
    YEAR EM NAME       PO
    2001 02 Scott      01
    2001 03 Tom        81
    SQL> Delete From employees
      2   Where rowid in (Select emp.rid
      3                     From (Select year, empcode, name, position,
      4                                  rowid as rid,
      5                                  row_number() over (partition by year, empcode, name
      6                                            order by year, empcode, name, position) as rn
      7                             From employees) emp
      8                    Where emp.rn > 1);
    4 rows deleted.
    SQL> select * from employees;
    YEAR EM NAME       PO
    2001 02 Scott      01
    2001 03 Tom        81
    SQL> if you can post a sample create tables and data it will help us provide you a some solutions.

  • How do I access and delete file from "Save to Your Online Account" area.

    I just downloaded the trial version of Acrobat XI.  I created a PDF file with sensitive information that I thought would be saved only to my computer but noticed that it was saved to my "online account." 
    I've searched and found how to reset that feature but I need to know how to access that Online Account and remove my file permanently from it. 
    Any help would be greatly appreciated (and necessary if I'm to purchase this tool).

    That's what it looks like to me, too.  It was only saved on my computer.  The reason I thought it might be saved online somewhere is because, when I saved the file, there was a box checked that said "Save To Your Online Account."  What does this mean then?
    Also, when I open the Acrobat application, the file is listed there under Recent Files and it doesn't give me a way to clear the recent file list.
    My goal is to make sure that my sensitive information is not being stored somewhere, anywhere online with Adobe or anyone else.  The only place I want that file to appear is in the documents file of my computer.

  • Does iPhone Packager CS 5.5 support camera access and LOADING images from the camera roll?

    Flash CS 5 only supports SAVING to the camera roll, not loading image from it. And it has no access to the camera to take pictures and access the image within the app.
    Does Flash CS 5.5 do these things? There's no point in upgrading if it doesn't support these core feature that I need.

    Hi.
    Just got an app  rejected because the popover to select the pics from the camera roll on  the iPad always appears on to-left corner, and the arrow doesn't point  anywere, and should be pointing to the button which activated it. That  "does not comply with the Apple iOS Human Interface Guidelines, as  required...". On the iPhone there's no issue because it takes over the  whole screen. More from the apple rejection message:
    "Specifically,  we noticed your app contained popover elements that didn't  point to  the element that revealed them. To avoid user confusion, a  popover  element's arrow should point to the element that revealed it."
    So, thanks for including the CameraRoll functionality, but it will be useless in the iPad apparently
    Any workaround to make it appear at a specific place when calling myCameraRoll.browseForImage() ?
    Fernando

  • Output displaying last row from resultset

    I have a class called user, which has only first, last name and email. I have a method in a UserDB class that reads a database and puts the results into the user class, then stores each user object in a vector. I know there are only 3 records, and my display is only showing the last record 3 times. I can't figure out what I am doing wrong.
    UsersServlet - calls the readRecord method and creates the vector to be stored in a session
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
              MurachPool connectionPool = MurachPool.getInstance();
              Connection connection = connectionPool.getConnection();
              Vector user = UserDB.readRecord(connection);
              HttpSession session = request.getSession();
              session.setAttribute("users", user);
              RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/user11/users.jsp");
            dispatcher.forward(request, response);
         }UserDB class - read record method.
    public static synchronized  Vector readRecord(Connection connection)
              User user = new User();
              Vector vector = new Vector();
              try{
                        String sql = "SELECT * FROM User ";
                        Statement statement = connection.createStatement();
                        ResultSet rs = statement.executeQuery(sql);
                        while(rs.next())
                             user.setFirstName(rs.getString("FirstName"));
                             user.setLastName(rs.getString("LastName"));
                             user.setEmailAddress(rs.getString("EmailAddress"));
                             vector.addElement(user);
                        return vector;
              }catch(SQLException e){
                   return null;
         }The jsp display page.
    <% java.util.Vector users = (java.util.Vector)session.getAttribute("users");
       for (int i =0; i<users.size(); i++){
          business.User user = (business.User)users.get(i);
          %>
      <tr valign="top">
        <td><p><%= user.getFirstName() %></p></td>
        <td><p><%= user.getLastName() %></p></td>
        <td><p><%= user.getEmailAddress() %></p></td>
         <td><p><%= i %></p></td>
        <td><a href="/user11/ShowUserServlet?emailAddress=<%=user.getEmailAddress()%>">Update</a></td>
        <td><a href="/user11/DeleteUserServlet?emailAddress=<%=user.getEmailAddress()%>">Delete</a></td>
      </tr>
      <%}%>

    A Vector is really an array of pointers. When you add the same User object to the vector several times you are adding many pointers to the same object. In this program you want several User objects, so you need to create a new one each iteration of the loop.
    You'll also need to close the ResultSet, Statement and Connection. Preferably in a finally statement.

  • Thin JDBC Driver is missing some rows from resultset

    Hi All
    I am faced with a peculiar problem.
    When I fire a SQL query using Toad, I get correct results but firing the same query using JDBC Driver - ojdbc14.jar (ORacle 11g R1) - we are getting lesser number of records.
    Our SQL pulls around 300k of records and buckets them based on some column value into different chunks. We use NTILE function and it shows right results in TOAD.
    Using same sql with JDBC, We are losing 100 rows per bucket.
    Any ideas?
    SQL is
    SELECT
    T.CTLG_ITM_ID as catalogItemIds,
    T.INV_STAT_TYP_ID,
    T.OORD_DT,
    T.LST_UPDT_DTTM,
    T.CTLG_ITM_SELL_TYP_ID,
    P.OORD_IND,
    C.BKORD_ELIG,
    NTILE(300) over (ORDER BY T.CTLG_ITM_ID) AS bucketId
    FROM
    INV_STAT_ROLLUP_T T,
    PRD_T P,
    CTLG_T C,
    CTLG_TREE_PATH_T TP
    WHERE
    T.CTLG_ITM_ID = TP.CTLG_ITM_ID AND
    TP.PAR_CTLG_ITM_ID = P.CTLG_ITM_ID AND
    C.BRD_CD = '10'
    As per toad, each bucket should get us 1038 records but Thin JDBC Driver is fetching us only 898 records.
    Any idea why this discrepancy?
    Thanks
    Saroj

    rozdev29 wrote:
    When I fire a SQL query using Toad, I get correct results but firing the same query using JDBC Driver - ojdbc14.jar (ORacle 11g R1)Seeing the downloads page:
    http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-111060-084321.html
    There IS no ojdbc14.jar for Oracle 11g. The minimum is Java 5. So correct me if I'm wrong, but you seem to be using a very old driver here. I would try a newer one if I were you.

  • Remote devive access and acquiring signals from a different PC in the same LAN

    Well, I'm still interested in knowing if the way to see the DAQ channels from one PC to another located in the same LAN is the Remote device acess RDA?
    If the answer is yes I would appreciate the information from sombody who has done it.
    Thanks

    Please don't create another question. I answered you to a previous one that is the same than this. Here is also the response.
    Hello,
    the only easy way in order to do that is to use RDA ( Remote Device Access ). This is a component that is installed when you install NI-DAQ. Currently, RDA is only supported by Traditional NI-DAQ. So, if you have programmed your application using NI-DAQmx, it might be more dificult because you will have to use networking communication VIs as Datasocket,TCP/IP, ....
    Here you have a link about RDA. There, there is a link to an Application Note called Networking Two PCs for Remote Data Acquisition
    http://digital.ni.com/public.nsf/websearch/5CC9792C6CD4A34C862565BC0072D5DF?OpenDocument
    I hope this helps.
    Regards
    crisR

  • Access and edit class from plugin element in Edge

    I'm creating a graph using d3 in Edge Animate. I can't seem to access the classes I apply to my svg elements.
    For example:
    I have a symbol on my Stage called graph, with the class d3graph
    In my d3 code, I create a svg  that I put in my graph symbol and add text to it:
    var svg = d3.select(".d3graph").append("svg").attr('width':100).attr('height':100);
    svg.append('text').attr('class', 'mytext');
    I've tried
    sym.$('mytext').someAction();
    but that doesn't work. When inspecting the webpage in my browser, I can see that the names of the classes I've applied to my Edge symbols changes, but not the names of the svg element classes:
    the class applied to text remains mytext
    while the class applied to graph is now Stage_graph_id d3graph
    How can I access elements with the class mytext in Edge?

    Hi, NYG-vibeke-
    Try referring to your custom classes with a # in front of it.
    sym.$("#mytext")...
    http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html
    There's a section that says "work with elements directly."
    Hope that helps,
    -Elaine

Maybe you are looking for

  • Exporting from FCP in QT Problem

    Hey, folks--would appreciate some help w/this. When I "export using quicktime" out of FCP-the newest version on my quad core--QT only exports about 15 seconds of whatever program it is. I've looked through the preferences in both QT Pro and FCP and f

  • Log4j?

    i download the Smslib project....& i try to enable the log4j, but i don't know where to find the log file...can anyone help me? This is the code for CService where i enable the log4j... if (_SYNC_ == null) _SYNC_ = new Object();           log = Logge

  • HT1386 IPOD syncing problem

    Neither of my MACs will recognize my old iPOD when I plug it in via USB.  Any thoughts on how to resolve?

  • Have to keep resetting iphone to get coverage back? Help

    In the last week my phone coverage blanks out. It's all good if I reset the phone but only temporarily. Just recently (2 days ago) I installed the new firmware 2.2.1. plus the carrier settings update. Any ideas?

  • Mac puts itself into Safe Boot.

    I don't touch the keyboard (I tried unplugging it) but suddenly my imac g4 17" boots in safe mode. Any suggestions? thank you alan