DataGrid's last row hangs out

Hi,
Has anybody else came accross the same problem I have currently? If yes can you share your solution? If you need more details, code snippets let me know.
Thanks,
    Daniel

Hi,
Actually there are 4 files involved.The upper grid is Main->RightTabPanels->WorkingOrders, the lower grid is  Main->OpenedPositions(I highlight those that are on the screen). The rest are not important to quote i think because they have the same problem. I also quote an example on how i refresh them.
Main.mxml
<mx:VDividedBox width="490" height="431" x="505" y="299">
    <mx:VBox width="100%" height="58%">
        <mx:Spacer height="18"/>
        <!-- right top panels -->
        <righttabpanels:RightTabPanels width="100%" height="100%"/>
    </mx:VBox>
    <mx:VBox width="100%" height="42%">
        <!-- right bottom panels -->
        <openedpositions:OpenedPositions />
    </mx:VBox>
</mx:VDividedBox>
RightTabPanels.mxml
<mx:TabNavigator id="tabNavigatorRightTabPanels" x="0" y="0" width="480" height="100%" styleName="tabNavigatorRightTabPanels">
    <mx:Canvas id="tabWorkingOrdersRightTabPanels" label="{expressions['RightButtonGroup_OrdersButton_Label']}" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="100%" height="100%">
       <workingorders:WorkingOrders />
    </mx:Canvas>
    <mx:Canvas id="tabTradeHistoryRightTabPanels" label="{expressions['RightButtonGroup_TradeHistoryButton_Label']}" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="100%" height="100%">
        <tradehistory:TradeHistoryPanel />
    </mx:Canvas>
    <mx:Canvas id="tabMyAccountRightTabPanels" label="{expressions['RightButtonGroup_MyAccountButton_Label']}" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="100%" height="100%">
        <myaccount:MyAccount />
    </mx:Canvas>
    <mx:Canvas id="tabPromotionsRightTabPanels" label="{expressions['RightButtonGroup_PromotionsButton_Label']}" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="100%" height="100%">
    </mx:Canvas>
</mx:TabNavigator>
WorkingOrders.mxml
<mx:DataGrid id="dataGridOrderBook"
    toolTipCreate="createTooltip(event)" itemRollOver="getHighlightedItem(event)"
    itemRollOut="itemRolledOut(event)" itemClick="itemClicked(event)" styleName="dataGridWorkingOrders" x="0" y="0" width="480" height="100%">
    <mx:columns>
        <mx:DataGridColumn dataField="direction" textAlign="center" headerText="{expressions['WorkingOrders_Table_Header_Direction_Label']}" width="45" />
        <mx:DataGridColumn dataField="size" textAlign="right" paddingRight="3" headerText="{expressions['WorkingOrders_Table_Header_Size_Label']}" width="45"/>
        <mx:DataGridColumn dataField="product" textAlign="center" headerText="{expressions['WorkingOrders_Table_Header_Product_Label']}" width="90"/>
        <mx:DataGridColumn dataField="price" textAlign="right" paddingRight="3" headerText="{expressions['WorkingOrders_Table_Header_Price_Label']}" width="55"/>
        <mx:DataGridColumn dataField="type" textAlign="center" headerText="{expressions['WorkingOrders_Table_Header_Type_Label']}" width="55"/>
        <mx:DataGridColumn dataField="validity" textAlign="center" headerText="{expressions['WorkingOrders_Table_Header_Validity_Label']}"/>
        <mx:DataGridColumn dataField="orderRef" textAlign="center" headerText="{expressions['WorkingOrders_Table_Header_OrderRef_Label']}" width="65"/>
        <mx:DataGridColumn dataField="" width="30">
            <mx:itemRenderer>
                <mx:Component>
                    <mx:HBox horizontalAlign="center">
                        <mx:Script>
                            <![CDATA[
                                private function clicked(event:MouseEvent):void {
                                    CommonProject.requests.sendCancelRequest(data.orderRef);
                            ]]>
                        </mx:Script>
                        <mx:Button id="buttonClose" styleName="buttonCloseOrderBook" click="clicked(event)" x="0" y="0" />
                    </mx:HBox>
                </mx:Component>
            </mx:itemRenderer>
        </mx:DataGridColumn>
    </mx:columns>
</mx:DataGrid>
OpenedPositions.mxml
<mx:VBox x="0" y="0" width="480" height="100%" verticalGap="0">
    <mx:Canvas width="100%" height="100%">
        <mx:Image id="imageOpenedPositionsHeader" styleName="imageOpenedPositionsHeader" x="0" y="0" width="100%" height="26" source="{imageOpenedPositionsHeader.getStyle('img')}" />
        <mx:TabNavigator id="tabNavigatorOpenedPositions" x="0" y="0" width="100%" height="100%" styleName="tabNavigatorOpenedPositions">
            <mx:Canvas horizontalScrollPolicy="off" verticalScrollPolicy="off" label="{expressions['Positions_OpenSummary_Label']}" width="100%" height="100%" id="tabOpenSummary">
                <tradehistory:RowColorDataGrid id="dataGridOpenedPositions" x="0" y="0" width="100%" height="100%" styleName="dataGridOpenedPositions">
                    <tradehistory:columns>
                        <mx:DataGridColumn dataField="direction" textAlign="center" headerText="{expressions['Positions_Table_Header_Direction_Label']}" width="45" />
                        <mx:DataGridColumn dataField="size" textAlign="right" paddingRight="3" headerText="{expressions['Positions_Table_Header_Size_Label']}" width="45" />
                        <mx:DataGridColumn dataField="product" textAlign="center" headerText="{expressions['Positions_Table_Header_Product_Label']}" width="90"/>
                        <mx:DataGridColumn dataField="price" textAlign="right" paddingRight="3" headerText="{expressions['Positions_Table_Header_Price_Label']}" width="55"/>
                        <mx:DataGridColumn dataField="market" textAlign="center" headerText="{expressions['Positions_Table_Header_Market_Label']}" width="55"/>
                        <mx:DataGridColumn dataField="timestamp" textAlign="center" headerText="{expressions['Positions_Table_Header_Timestamp_Label']}"/>
                        <mx:DataGridColumn dataField="pnl" textAlign="right" itemRenderer="screens.openedpositions.PNLItemRenderer" paddingRight="3" headerText="{expressions['Positions_Table_Header_PNL_Label']}" width="55"/>
                        <mx:DataGridColumn dataField="" width="30">
                            <mx:itemRenderer>
                                <mx:Component>
                                    <mx:HBox horizontalAlign="center" verticalAlign="middle">
                                        <mx:Script>
                                            <![CDATA[
                                                private function clicked(event:MouseEvent):void {
                                                    CommonProject.openedTrades.closePosition(data.productReal, data.directionReal);
                                            ]]>
                                        </mx:Script>
                                        <mx:Button id="buttonClose" styleName="buttonCloseOpenedPositions" click="clicked(event)" x="10" y="2" />
                                    </mx:HBox>
                                </mx:Component>
                            </mx:itemRenderer>
                        </mx:DataGridColumn>
                    </tradehistory:columns>
                </tradehistory:RowColorDataGrid>
            </mx:Canvas>
            <mx:Canvas horizontalScrollPolicy="off" verticalScrollPolicy="off" label="{expressions['Positions_OpenTrades_Label']}" width="100%" height="100%" id="tabOpenTrades">
                <mx:DataGrid id="dataGridOpenedTrades" x="0" y="0" width="100%" height="100%" styleName="dataGridOpenedPositions">
                    <mx:columns>
                        <mx:DataGridColumn dataField="direction" textAlign="center" headerText="{expressions['Positions_Table_Header_Direction_Label']}" width="45" />
                        <mx:DataGridColumn dataField="size" textAlign="right" paddingRight="3" headerText="{expressions['Positions_Table_Header_Size_Label']}" width="45" />
                        <mx:DataGridColumn dataField="product" textAlign="center" headerText="{expressions['Positions_Table_Header_Product_Label']}" width="90"/>
                        <mx:DataGridColumn dataField="price" textAlign="right" paddingRight="3" headerText="{expressions['Positions_Table_Header_Price_Label']}" width="55"/>
                        <mx:DataGridColumn dataField="market" textAlign="center" headerText="{expressions['Positions_Table_Header_Market_Label']}" width="55"/>
                        <mx:DataGridColumn dataField="timestamp" textAlign="center" headerText="{expressions['Positions_Table_Header_Timestamp_Label']}"/>
                        <mx:DataGridColumn dataField="pnl" textAlign="right" paddingRight="3" itemRenderer="screens.openedpositions.PNLItemRenderer" headerText="{expressions['Positions_Table_Header_PNL_Label']}" width="55"/>
                        <mx:DataGridColumn dataField="" width="30">
                            <mx:itemRenderer>
                                <mx:Component>
                                    <mx:HBox horizontalAlign="center" verticalAlign="middle">
                                        <mx:Script>
                                            <![CDATA[
                                                private function clicked(event:MouseEvent):void {
                                                    CommonProject.openedTrades.closePosition(data.tradeRef);
                                            ]]>
                                        </mx:Script>
                                        <mx:Button id="buttonClose" styleName="buttonCloseOpenedPositions" click="clicked(event)" x="0" y="2" />
                                    </mx:HBox>
                                </mx:Component>
                            </mx:itemRenderer>
                        </mx:DataGridColumn>
                    </mx:columns>
                </mx:DataGrid>
            </mx:Canvas>
        </mx:TabNavigator>
        <mx:Label id="labelPnL" text="" fontFamily="{CommonProject.boldFont}" styleName="labelOpenPositionsLabel" x="250" y="3" width="220" />
    </mx:Canvas>
    <mx:Canvas width="100%" height="2" backgroundColor="#cfcfcf" />
</mx:VBox>  
refresh method for dataGridOpenedTrades and dataGridOpenedPositions
public function refresh():void {
    if (CommonProject.application.viewStack.selectedIndex == 1) {
        var vScroll:int = dataGridOpenedTrades.verticalScrollPosition;
        dataGridOpenedTrades.dataProvider = CommonProject.openedTrades.getDisplayedTrades();
        dataGridOpenedTrades.verticalScrollPosition = vScroll;  // restore scroll position
        dataGridOpenedTrades.validateNow();
        vScroll = dataGridOpenedPositions.verticalScrollPosition;
        dataGridOpenedPositions.dataProvider = CommonProject.openedTrades.getDisplayedPositions();
        dataGridOpenedPositions.verticalScrollPosition = vScroll;  // restore scroll position
        dataGridOpenedPositions.validateNow();

Similar Messages

  • How do I create a new row on tab out of the last column, last row?

    JDev 11.1.2.1.0.
    I've seen a few topics on this but none that I think were really very good solutions.
    Use Case:
    On tab out of the last column in the last row, a new row should be added to the end of the table. Bonus points for setting the focus to the first <af:inputText> of the newly created row.
    Complications:
    1. I'm having a heck of a time trying to find a function that returns the column's displayed index. Sadly, <column binding>.getDisplayIndex() returns -1 unless the user has manually re-ordered the column.
    2. Value Change Listeners only fire if there is a value change. Guess that means I need to do client/server listeners to check each and every <af:inputText> for a tab press?
    3. I'm not even going to get into setting the focus. With all the templates, regions, etc. going on, it's dang near impossible.
    Any ideas on how to attack this one?
    Will

    Hi,
    You will need to use the Run Engine Installation Wizard found on the Tools menu. In addition you need to create a installation set for the operator interface.
    Look at Chapter 16 Distrubuting TestStand ( chapter 17 for version 2).
    Once you have created your installation, install is on your new system.
    The serial number etc is part of the process model. When you run the entry point 'Test UUTs' the PreUUT callback is executed which asks the user for the serial number.
    Hope this helps
    Ray Farmer
    Regards
    Ray Farmer

  • To find out the last row that is updated in a View Object

    Hi OAF Gurus,
    I have requirement like,
    I have to find out the last row that is updated on a particular View Object and I have send a mail to the users about the change.
    JegSAMassMobVOImpl vo = getJegSAMassMobVO1();
    JegSAMassMobVO is the View Object Name and it displays certain rows that has already been added to the VO in the Page.
    Now the issue is when a user updates a particular row,I have to find which row gets updated and have to send a email to that particular employee about the change.
    Just want to know,how to find out the last updated row in a particular VO.
    Any Help would be appreciated as this a immediate requirement.
    Regards,
    Magesh.M.K.
    Edited by: user1393742 on May 4, 2011 1:06 AM

    Hi Magesh
    It shoud be a Advanced table ,so when user will update the row ,the specific row will fire the PPR and on that event u can capture the row using row reference ,this is the sample code below
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean); OAApplicationModule am =
    (OAApplicationModule)pageContext.getApplicationModule(webBean);
    String event = pageContext.getParameter("event");
    if ("<ItemPPREventName>").equals(event))
    // Get the identifier of the PPR event source row
    String rowReference =
    pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    Serializable[] parameters = { rowReference };
    // Pass the rowReference to a "handler" method in the application module.
    262
    am.invokeMethod("<handleSomeEvent>", parameters);
    In your application module's "handler" method, add the following code to access the source row:
    OARow row = (OARow)findRowByRef(rowReference);
    if (row != null)
    Thanks
    Pratap

  • Datagrid last row flickering problem.

    Hi,
        I used flex 3.5 datagrid. It is a complex datagrid with lot of itemrenderers and itemeditors.when my datagrid has vertical scroll and when i scroll datagrid, last row keep on flickering.
         any idea or solution for this problem?   

    my grid contains 6 columns. Among 6, some of the column texts are  visible some of them hided.
    it is only happens to last row of the Datagrid.
    This is happened when i scroll my datagrid vertically.

  • DataGrid - Query´s Last Row as Footer

    Hi!
    I have a query like:
    SELECT [User], 'Qtd' = Count(DISTINCT [OrderId])
    FROM [Jobs]
    GROUP BY [User]
    UNION
    SELECT 'Total', 'Qtd' = Count(DISTINCT [OrderId])
    FROM [Jobs];
    And I´m displaying this query result in a DataGrid object in an ASPX page.
    I´d like to set the last row of the query as a footer with a specific formatting. How do I set the last row of my query as a footer record at the DataGrid?
    Thanks,
    Molina.

    Hello,
    Please ask your question over in the ASPNET forum
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • Lock datagrid last row with agregates (don't know what to do next :( )

    Hi,
    I have been googling for 2 hours and have been reading some forum posts, etc... but can't get this thing working. It seems an important flaw in datagrid, because I'm sure lota peopple needs this, but I've not found a good solution.
    What I need to do is add a row of agregates to a datagrid that contains flat data (it must be last one, and locked, I mean, must not scroll). I have been reading about this:
    http://blogs.adobe.com/aharui/2008/03/flex_3_datagrid_footers.html
    But this makes the row separated from the grid, I mean, It is not really a datagrid row. Other problems arise using this implementation like, impossibility to keep last row aligned with datagrid columns when scrolling (I need to scroll because I have lota columns), etc...
    So, could anybody please help here to accomplish this? I think it is a pretty common task and it is a bit dissapointing it can't be done easily with flex.
    Thanks in advance,
    Aron.

    I haven't seen this done.
    You can add a summary row fairly easily using the Advanced Data Grid:
    http://livedocs.adobe.com/flex/3/html/help.html?content=advdatagrid_10.html

  • How to Finding the Last Row Value in Datagrid?

    Hi Everyone,
    Thanks in Advance.
    I need your help, to find the last row data in Datagrid.
    Actually i am using Datagrid to display my Data in flex. In my data i stored the gender value of employees. So if the last row in my datagrid is "female" i need to be highlight that particular row. So please help me to solve this issue.
    Thanks,
    Charles. J

    datagrid.selectedIndex = datagrid.dataprovider.length;
    ^ something like this will select the last row in the datagrid.
    if you need to check it's value, you might need to cast an object here, based on the index value, and check it's gender value.
    datagrid.selectedIndex = datagrid.dataprovider.length;
    if (datagrid.selectedItem["gender"] == "female") {
    //handle here

  • Itunes won't start, iPhoto / Front Row Hang after Leopard install

    I upgraded a Intel 2.0MHz 24" iMac this morning. I have never had any upgrade problems before. Last night the iLife 8.1.1 update was installed. Was using iTunes all morning. I got my Leopard CD via Fedex and popped it in. Install went smoothly with no issues. The only thing out of the ordinary during the installation was that I hit cancel when the Time Machine setup opened because I don't have a hard disc ready for it yet.
    All seems to be OK except for iTunes, iPhoto, and Front Row.
    1. iTunes hangs every time I try to start it and I have to Force Quit. Library is on an external drive that is available and working in Finder.
    2. iPhoto will open and show my library, but hangs anytime I chose Edit. Library is on main drive, but I have preferences set not to have iPhoto copy items to the library. I tried rebuilding library but that hangs too.
    3. Front Row hangs when I choose music or movies. I can't exit it and have to do a hard shutdown.
    This is my first disappointment since switching about six months ago. Any insight on how to fix this would be appreciated. I am fully backed up prior to install, but it was not a bootable backup.

    I seem to have located the problem. I disabled my Perian install and iTunes, iPhoto, and Front Row started working. I also reinstalled the MPEG2 support for Quicktime, but I believe Perian is what fixed the issue.

  • Hiding bloc of Lines in a web template in the last row

    Hello,
    I want to hide a bloc of lines in a web query.
    Here I use the table interface with the method
    characteristic cell according to the "How to" - paper
    (How to hide a column).
    Normally , there is no problem to set the tag
    '<!--' in the first column ot the row to be suppressed and the tag
    '-->' in the first column of the row, I want to display again.
    But the problem is the last row. Here I must close the
    tag in the last column of the last row. The effect is
    something like a double line at the end of the output.
    (I think, I see here another time the first column of
    a row, because I cannot close the tag properly)
    As a result, I have problems with the print manager, we use to enhance the web printing.
    Can someone give me the information, how to close the tag
    in a proper way at the last row.
    Many thanks for your help.
    Regards
    Ralph

    Hi,
    I don't think this is possible. I would try to use c_cell_extend to extend the style of each <td>-Tag with style="visibility:hidden; display:none" This should have the same affect (for all cells which have to be hidden) (depending on your table styles there might be some padding or spacing effects; you have to try this out).
    Heike

  • Trying to get the last row from a resultset

    Hi,
    I'm trying to do a query to postgreSQL and have it return the last updated value, (last row).
    My prepared statement is returning the correct results, but i'm having a problem getting the latest value.
    I'm using a comboBox to drive a textfield, to load the last entered values in depending on which item in the comboBox is selected.
    I've tried a variety of things and most seem to return the first row, not showing the updated values.
    Or, if it does work, it takes to long to load, and i get an error.
    here is the working code;
    Object m = machCBX.getSelectedItem():
    try { PreparedStatment last = conn.prepareStatement("SELECT part, count FROM production WHERE machine = ?",
    ResultSet.TYPE_SCROLL_INSENSITIVE,  //tried both INSENSITIVE and SENSITIVE
    ResultSet.CONCUR_READ_ONLY);
    last.setString(1, String.valueOf(m));
    rs. = last.executeQuery();
    if(rs.isAfterLast) == false ) {
    rs.afterLast();
    while(rs.previous()) {
    String p = rs.getString("part");
    int c = rs.getInt("count");
    partJTX.setText(p);
    countJTX.setText(c);
    }this grabs values, but they are not the last entered values.
    Now if i try to use rs.last() it returns the value i'm looking for but takes to long, and i get:
    Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space I also know using ra.last() isn't the best way to go.
    I'm just wondering if there is another way other than getting into vectors and row count? or am i better off to go with the later?
    thanks
    -PD

    OK, you've got a major misunderstanding...
    The relational database model is built on the storage of sets - UNORDERED sets. In other words, when you hand a database a SELECT statement without an ORDER BY clause, the database is free to return the results in any order.
    Now it so happens that most databases will happen to return data retrieved by an unordered SELECT, at least for a while, in the same order that it was inserted, especially if no UPDATE or DELETE activity has occured, and no database maintenance has occured. However, eventually most tables have some operation that creates a "space" in the underlying storage, or causes a row to expand and have to be moved or extended, or something. Then the database will start returning unordered results in a different order. If you (or other people) never ever ever UPDATE or DELETE a table, then on some databases the data might well come out in insertion order for a very very long time; given human nature and the way projects tend to work, relying on that is a sucker's bet, IMHO.
    In other words, if you want the "most recent" something, you need to store a timestamp with your data. (With some databases, you might be able to take advantage of some non-standard feature to get "last updates" or "row change timestamps", but I know of no such for Postgres.
    While this won't solve your major problem, above, your issue with rs.last is probably occuring because Postgres by default will prefetch your entire ResultSet. Use Statement.setFetchSize() to change that (PreparedStatement inherits the method, of course).

  • HELP! How te retrieve the last row in MYSQL database using Servlet!

    Hi ,
    I am new servlets. I am trying to retireve the last row id inserted using the servlet.
    Could someone show me a working sample code on how to retrieve the last record inserted?
    Thanks
    MY CODE
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class demo_gr extends HttpServlet {
    //***** Servlet access to data base
    public void doPost (HttpServletRequest req, HttpServletResponse resp)
         throws ServletException, IOException
         String url = "jdbc:mysql://sql2.njit.edu/ki3_proj";
              String param1 = req.getParameter("param1");
              PrintWriter out = resp.getWriter();
              resp.setContentType("text/html");
              String semail, sfname, slname, rfname, rlname, remail, message;
              int cardType;
              sfname = req.getParameter("sfname");
              slname = req.getParameter("slname");
              rfname = req.getParameter("rfname");
              rlname = req.getParameter("rlname");
              semail = req.getParameter("semail");
              remail = req.getParameter("remail");
              message = req.getParameter("message");
              //cardType = req.getParameter("cardType");
              cardType = Integer.parseInt(req.getParameter("cardType"));
              out.println(" param1 " + param1 + "\n");
         String query = "SELECT * FROM greeting_db "
    + "WHERE id =" + param1 + "";
              String query2 ="INSERT INTO greeting_db (sfname, slname ,semail , rfname , rlname , remail , message , cardType ,sentdate ,vieweddate) values('";
              query2 = query2 + sfname +"','"+ slname + "','"+ semail + "','"+ rfname + "','"+ rlname + "','"+ remail + "','"+ message + "','"+ cardType + "',NOW(),NOW())";
              //out.println(" query2 " + query2 + "\n");
              if (semail.equals("") || sfname.equals("") ||
              slname.equals("") || rfname.equals("") ||
              rlname.equals("") || remail.equals("") ||
              message.equals(""))
                        out.println("<h3> Please Click the back button and fill in <b>all</b> fields</h3>");
                        out.close();
                        return;
              String title = "Your Card Has Been Sent";
              out.println("<BODY>\n" +
    "<H1 ALIGN=CENTER>" + title + "</H1>\n" );
                   out.println("\n" +
    "\n" +
    " From  " + sfname + ", " + slname + "\n <br> To  "
                                            + rfname + ", " + rlname + "\n <br>Receiver Email  " + remail + "\n<br> Your Message "
                                            + message + "\n<br> <br> :");
                   if (cardType ==1)
                        out.println("<IMG SRC=/WEB-INF/images/bentley.jpg>");
                   else if(cardType ==2) {
                        out.println("<IMG SRC=/WEB-INF/images/Bugatti.jpg>");
                   else if(cardType ==3) {
                        out.println(" <IMG SRC=/WEB-INF/images/castle.jpg>");
    else if(cardType ==4) {
                        out.println(" <IMG SRC=/WEB-INF/images/motocross.jpg>");
    else if(cardType ==5) {
                        out.println(" <IMG SRC=/WEB-INF/images/Mustang.jpg>");
    else if(cardType ==6) {
                        out.println("<IMG SRC=/WEB-INF/images/Mustang.jpg>");
    out.println("</BODY></HTML>");
         try {
              Class.forName ("com.mysql.jdbc.Driver");
              Connection con = DriverManager.getConnection
              ( url, "*****", "******" );
    Statement stmt = con.createStatement ();
                   stmt.execute (query2);
                   //String query3 = "SELECT LAST_INSERT_ID()";
                   //ResultSet rs = stmt.executeQuery (query3);
                   //int questionID = rs.getInt(1);
                   System.out.println("Total rows:"+questionID);
    stmt.close();
    con.close();
    } // end try
    catch (SQLException ex) {
              //PrintWriter out = resp.getWriter();
         resp.setContentType("text/html");
              while (ex != null) { 
         out.println ("SQL Exception: " + ex.getMessage ());
         ex = ex.getNextException ();
    } // end while
    } // end catch SQLException
    catch (java.lang.Exception ex) {
         //PrintWriter out = resp.getWriter();
              resp.setContentType("text/html");     
              out.println ("Exception: " + ex.getMessage ());
    } // end doGet
    private void printResultSet ( HttpServletResponse resp, ResultSet rs )
    throws SQLException {
    try {
              PrintWriter out = resp.getWriter();
         out.println("<html>");
         out.println("<head><title>jbs jdbc/mysql servlet</title></head>");
         out.println("<body>");
         out.println("<center><font color=AA0000>");
         out.println("<table border='1'>");
         int numCols = rs.getMetaData().getColumnCount ();
    while ( rs.next() ) {
              out.println("<tr>");
         for (int i=1; i<=numCols; i++) {
    out.print("<td>" + rs.getString(i) + "</td>" );
    } // end for
    out.println("</tr>");
    } // end while
         out.println("</table>");
         out.println("</font></center>");
         out.println("</body>");
         out.println("</html>");
         out.close();
         } // end try
    catch ( IOException except) {
    } // end catch
    } // end returnHTML
    } // end jbsJDBCServlet

    I dont know what table names and fields you have but
    say you have a table called XYZ which has a primary
    key field called keyID.
    So in order to get the last row inserted, you could
    do something like
    Select *
    from XYZ
    where keyID = (Select MAX(keyID) from XYZ);
    Good Luckwhat gubloo said is correct ...But this is all in MS SQL Server I don't know the syntax and key words in MYSQL
    This works fine if the emp_id is incremental and of type integer
    Query:
    select      *
    from      employee e,  (select max(emp_id) as emp_id from employee) z
    where      e.emp_id = z.emp_id
    or
    select top 1 * from employee order by emp_id descUday

  • Delete last row in a table - why won't it delete?

    I cannot delete the last row in any of my tables. (InDesign CS2). The option is greyed out - is this by design or a bug and how can I delete it?
    Thanks.

    No,
    The table has two header rows and no footers. The row I cannot delete is the third row which must therefore be a body row.

  • Tabular form last row not accessible through PL/SQL

    i am using apex 3.2
    I have created one tabular form for daily receipt of material.
    data get stared in table storereceipt. Now I have created one PL/SQL , it reads each row of tabular form one by one and update quantity of item in master table.
    begin
    FOR i IN 1 .. apex_application.g_f02.COUNT
    LOOP
    if apex_application.g_f12(i) != 'LOCK' then
    update inv_ms_item set qty = qty apex_application.g_f11(i)+ this row update quantity in another table
    where id = apex_application.g_f10(i);
    end if;
    END LOOP;
    end;
    problem arrives in last row, which was created blank with add row then data was entered and submit button was clicked.
    my pl/sql is called on click of submit button . it updates all items except on last row.
    remaining things works fine.
    if i create 5 rows with add row and click one more time. last row will be blank. now if i click submit then all rows get updated and as last row is blank i dont have to care about it.
    Edited by: TEJU on Oct 21, 2010 4:40 PM
    Edited by: TEJU on Oct 21, 2010 4:40 PM

    Hi ,
    Teju this is the major drawback in the apex 3.2 because if u see the length when there is only one record is present in the tabular form
    then the outpuyt u will get is undefined , but though the colum exists it wont .
    i have faced this problem , one thing u can do is use document.getElementByID method of java script
    first find out the length , that specifies how many rows are present then write a loop
    for 1=0 till i<=-tahta length
    document.getElemetByid('f01_00'+i)
    /* this will give u f01_001 ...this can be ur element 1 , f01_002 this will ur element two .
    I had already used it and its working fine...
    Regards,
    Nandini Thakur.

  • Printing Serials with ALD print first serial double in last row

    Hallo,
    when we print serials the first serial will be printed  in a additionally last row befor the next article will be print out.
    Example:
    Article      quantity    
    4711         3
    Serial: abc
    Serial: def
    Serial: ghi
    Serial: abc <- This line is unnecessary and should not
                   be print out
    To print the serial numbers we use the following formula:
    if(Belegzeile.Seriennummer.Seriennummer<>"", "Seriennummer: " + Belegzeile.Seriennummer.Seriennummer ,"") 
    Datstellungsbedinung:
    Previous (Belegzeile.Zeilennummer) = Belegzeile.Zeilennummer and Previous (Belegzeile.Seriennummer.Seriennummer) <> Belegzeile.Seriennummer.Seriennummer
    The Version of the ALD ist 6.70.1.5
    Any Idea?
    Best regards,
    Michael

    Hi,
    Check SAP Business One Customer Portal on The Marketplace.
    Search the Hint Nr. 813796
    "... It is possible to create a data line definition for a document line and its item information. Also
    it is possible to create a data definition line for all serial number information using ONLY fields from the
    node "DocumentLine(s)->SerialNumber")
    IT IS NOT ALLOWED TO MIX THE FIELDS!
    How to identify the different line types?
    The designing tool has to identify which line type should be printed, e.g. should data definition line for the
    document line or the data definition line for the serial number be printed
    There is a Field below the folder "DocuemtLine(s)" named "LineType". This line type identifies which line
    definition should be used. Use this field as an appearance condition for the several data definition lines.
    e.g. Use the data definition line or the serial number only if DocumentLines.LineType = "SRI", or use the
    fields of the document line and the item only if DocumentLines.LineType = "R"
    Which line types do exist?
    Currently the following line types exist
    LineType Description Valid Folder
    "S" "Summation" (DocumentLines->Structure)
    "T" "Text" (see LineType "S")
    "IBT" "Batch Number" (DocumentLines->BatchNumber)
    "SRI" "Serial Number" (DocumentLines->SerialNumber)
    "R" "Regular Item" (Everything else but above)
    "A" "Alternative Article" (see LineType "R")
    this Doc may help

  • Get rows where the last row finish off

    Hi, i have two tables AND would LIKE TO get data BY combining both.
    here IS my data
    WITH hist AS
      SELECT To_Date('4/23/2010','mm/dd/yyyy') dt, 999 alias, 'PROC' dom FROM dual UNION ALL
      SELECT To_Date('4/27/2010','mm/dd/yyyy') dt, 999 alias, 'LON' dom FROM dual UNION all
      SELECT To_Date('4/1/2010','mm/dd/yyyy') dt, 111 alias, 'SOC' dom FROM dual UNION all
      SELECT To_Date('4/10/2010','mm/dd/yyyy') dt, 111 alias, 'NAO' dom FROM dual UNION ALL
      SELECT To_Date('3/23/2010','mm/dd/yyyy') dt, 222 alias, 'PSE' dom FROM dual
    final AS
      SELECT To_Date('2/26/2010','mm/dd/yyyy') dt, 999 alias FROM dual UNION ALL
      SELECT To_Date('4/22/2010','mm/dd/yyyy') dt, 999 alias FROM dual UNION all
      SELECT To_Date('4/26/2010','mm/dd/yyyy') dt, 999 alias FROM dual UNION ALL
      SELECT To_Date('4/30/2010','mm/dd/yyyy') dt, 999 alias FROM dual UNION ALL
      SELECT To_Date('2/25/2010','mm/dd/yyyy') dt, 111 alias FROM dual UNION ALL
      SELECT To_Date('2/26/2010','mm/dd/yyyy') dt, 222 alias FROM dual UNION ALL
      SELECT To_Date('4/22/2010','mm/dd/yyyy') dt, 222 alias FROM dual UNION all
      SELECT To_Date('4/26/2010','mm/dd/yyyy') dt, 222 alias FROM dual
    the output should be as follow(without the extra blank line of course)
    DT           ALIAS   DOM
    2/26/2010     999     PROC
    4/22/2010     999     PROC
    4/26/2010     999     LON
    4/30/2010     999     LON
    4/27/2010     999     LON
    4/23/2010     999     PROC
    2/25/2010     111     SOC
    4/1/2010     222     SOC
    4/10/2010     222     NAO
    2/26/2010     222     PSE
    4/22/2010     222     PSE
    4/26/2010     222     PSEso what i am doing here is as follow, take one row in hist table (4/23) and join with final table and give me all rows in final table
    where dt <= to the row in hist table and include the row from hist table.
    this logic will give me rows 2/26/2010,4/22/10 4/23/2010
    then the second row in hist table (4/27/2010) wiill get all rows
    in final table that is <= to the current row and pick up the rows starting from the row > than the last row where the 4/23/2010 finished off
    in this case the output will be 4/26/10, 4/27/2010(we need to include row from hist)
    since there is no row in hist that is greater than 4/30/2010, this date will still be display and dom column value should be taking from the max date in hist
    which is 4/27/2010. see output above
    this sound a little confusing to explain but look at output of what to expect as output. the other ids should follow the same logic
    can someone help write a query for this? thanks

    Hi,
    Devx wrote:
    Frank, thanks again, i ran the query in oracle 11g and oracle 9i. 11g runs ok but 9i doesnt. it looks like the ignore null option is not supported in 9i. That's right: IGNORE NULLS was new in Oracle 10. You should always mention your Oracle version whenever you ask a quiestion, especially if it's as old as Oracle 9.
    i will be running this query in 9i. is there any alternative to re-write this query without using last value since ignore null is not supported and the output is not as i expected when i take that keyword out.
    i really appreciate your help. please let me know how would i re-write the query. thanksOne work-around is to use LEAD or LAG instead of LAST_VALUE. This means you have to know exactly where (how many rows away) the most recent non-NULL value is, which in turn requires other analytuic funtions, such as ROW_NUMBER, and more sub-queries:
    WITH     combined_tables        AS
         SELECT     dt, alias, NVL (dom, '_?_') AS dom     FROM hist
         UNION
         SELECT     dt, alias, NULL          AS dom      FROM final
    ,     got_r_num     AS
         SELECT     dt, alias, dom
         ,     ROW_NUMBER () OVER ( PARTITION BY  alias
                                   ORDER BY          dt
                           )               AS r_num
         ,     COUNT (*)     OVER ( PARTITION BY  alias
                           )               AS alias_cnt
         FROM    combined_tables
    ,     got_skip_cnts     AS
         SELECT     dt, alias, dom, r_num
         ,     r_num - MAX (CASE WHEN dom IS NOT NULL THEN r_num END)
                                 OVER ( PARTITION BY  alias
                               ORDER BY          r_num
                             )                    AS skip_before
         ,     MIN (CASE WHEN dom IS NOT NULL THEN r_num END)
                                 OVER ( PARTITION BY  alias
                               ORDER BY          r_num     DESC
                             ) - r_num               AS skip_after
         FROM    got_r_num
    ,     got_next_dom     AS
         SELECT     dt, alias, dom, r_num, skip_before
         ,     LEAD (dom, skip_after) OVER ( PARTITION BY  alias
                                                ORDER BY      r_num
                                 ) AS next_dom
         FROM    got_skip_cnts
    SELECT       dt
    ,       alias
    ,       NULLIF ( COALESCE ( next_dom
                            , LAG (dom, skip_before) OVER ( PARTITION BY  alias
                                                         ORDER BY         r_num
               )     AS dom
    FROM       got_next_dom
    ORDER BY  alias
    ,            dt
    ;You should be able to calculate bot LEAD and LAG in the same query, but there seems to be a bug that only calculates one of them correctly in this case. The sub-query got_next_dom gets around that, by doing the LEAD in a separate sub-query.

Maybe you are looking for

  • [SOLVED] Problem with acpid and systemd-logind

    Hi, I have the following problem: I want set an action, when power button is pushed, different from shutdown and I want do this with a rule in acpid. Before set a rule in acpid, I modified the /etc/systemd/logind.conf in the following way: HandlePowe

  • Change Reconciliation account - reverse documen

    HI, I have changed the reconciliation account for the customer. In the next step I have run SAPF101 program to transfer balance between the old and the new reconciliation account. SAPF101 has used the adjustment accounts according to the OBBW configu

  • Will SATA 11  HD work with sonnet SATA controller

    Hi I need more space and have seen this on eBay Will it work with my G4 Giga fitted with a Sonnet Serial ATA (it doesn't say whether or not on the box.) I already have a Seagate 7200 3.5 500gb fitted and it works fine. If my Sonnet is not compatible

  • Get values in dropdown field based on f4 help in another field

    Hi Experts, How to Get values in dropdown field based on another field which is F4 Help. If I select one value in f4 help field(ex: 1) I need to get values in dropdown field (ex:a, b, c),If I select another value in f4 help (ex:2) I need to populate

  • My Quicktime disappeared! MAC OS 10.6.8

    I don't know when, or how, but Quicktime is no where to be seen on my iMac! If I try and open a .wmv something trys to load but then it quickly closes the app it's trying to use. Because mac's are so fast, I can't even see the icon. Anyway, I tried l