Display multiple paging

hello all,
i am having problem to paging my result in multiple pages. i'm already searching in this forum on how to solve on paging pages but none of them can help me. here is my code..
// paging section
int rownumb = listof.countData(offer_type);
out.println("row : " +rownumb);
int perpage = 2;
int pageno = rownumb/perpage;
int balance = rownumb - (pageno * perpage);
if (balance != 0) {
pageno = pageno + 1;
out.println(" balance : " balance "<br>");
out.println(" rownumb pageno : " pageno "<br>");
int inc =0;
for (int i=1; i<=pageno ; i++) {
if ( i == pageno) { %>
<font color="#ff3366"><%=i%></font>
<% }
else { %>
<a href="ListOffer.jsp?offer_type=<%=offer_type%>&pageno=<%=i%>"><%
out.println("displaying page number : " i "<br></a>");
listof.queryCategory(offer_type);
col = listof.getColumn();
row = listof.getRow();
outVector = listof.getVectorRow();
++inc;
// end paging
//in my java bean file
function countData
String query = SELECT count(*) FROM offer
WHERE otype= '"+offer_type+"' AND ostatus = 'posted'";
function queryCategory
String query = SELECT offerid, otitle, odescription, oposted_date, oexpiry_date FROM offer WHERE otype='"+offer_type+"' AND ostatus='posted' AND (oposted_date <= '"+currentDate+"' AND oexpiry_date >= '"+currentDate+"')ORDER BY offerid ASC LIMIT 2 ";
the problem is i can't display 2 data in one pages eventhough the code already limit the data to display 2 rows in 1 pages.
can anybody solve for me?
</a>

I can offer my 2-cents but...
I'm assuming you are using a MySQL database. What does your query return when you run it from the MySQL prompt? It's good practice to execute your queries in some SQL client before hand.
From MySQL Reference Manual:
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments.
If two arguments are given, the first specified the offset of the first row to return; the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):
mysql> select * from table LIMIT 5,10; # Retrieve rows 6-15
If one argument is given, it indicates the maximum number of rows to return:
mysql> select * from table LIMIT 5; # Retrieve first 5 rows
In other words, LIMIT n is equivalent to LIMIT 0,n.
Just a note, LIMIT performs much faster on large result sets, however, it is a non-standard MySQL extension, and therefore, it is suggested to avoid using it in queries.
First thing I can see is that the way you are using LIMIT, the first two records will always be returned. You would need to pass two parameters (or at least one -> start) to queryCategory, i.e.
public void queryCatetory(int start, int count)
String query = "... LIMIT " + start + "," + count;
Also, you don't need to execute another query (the countData function) to get the record count, simply move the ResultSet cursor to the last position and get the row number, i.e.
rs.last();
noRows = rs.getRow();
For the pageno value, this is what you should be getting as a parameter to the page.
int pageno = Integer.parseInt(request.getParameter("pageno"));
For the query paging part, I can offer this bit of code which might help:
final int ROW_COUNT = 10;
int currPage, rowStart, rowStop, totalPages, noRows;
String scriptName = request.getRequestURI();
String query = "SELECT offerid, otitle, odescription, oposted_date, oexpiry_date FROM offer WHERE otype='"+offer_type+"' AND ostatus='posted' AND (oposted_date <= '"+currentDate+"' AND oexpiry_date >= '"+currentDate+"') ORDER BY offerid";
// get the page parameter
try { currPage = Integer.parseInt(request.getParameter("pageno"); }
catch (NumberFormatException e) { currPage = 1; }
// connect to database and execute query
PreparedStatement stmt = conn.prepareStatement(query);
ResultSet rs = stmt.executeQuery();
// get the record count
rs.last();
noRows = rs.getRow();
if (noRows == 0)
out.println("Sorry, no records found!");
else
// calculate row start/stop and total pages
// if current page is 2, we want to display records 11-20
rowStart = (currPage - 1) * ROW_COUNT + 1;
// alternatively, you can do:
// rowStop = Math.min(noRows, currPage * ROW_COUNT);
rowStop = Math.min(noRows, rowStart + ROW_COUNT - 1);
// division by integer yeilds a truncated integer value so we
// have to check for a remainder, but you can also do:
// totalPages = (int)Math.ceil(ROW_TOTAL / (ROW_COUNT * 1.0));
totalPages = (noRows / ROW_COUNT) + (noRows % ROW_COUNT == 0 ? 0 : 1);
// set result set to start position and print the records
rs.absolute(rowStart);
for (int row = rowStart; row <= rowStop; row++)
// display current record data
rs.next();
// print query paging links
out.print("<p align=\"center\">");
if (currPage > 1)
out.print(" <a href=\"" + scriptName + "?pageno=" + (currPage - 1) + "\">< Prev</a>");
for (int i = 1; i <= totalPages; i++)
if (i == currPage)
out.print(" <b>" + i + "</b>");
else
out.print(" <a href=\"" + scriptName + "?pageno=" + i + "\">" + i + "</a>");
if (currPage < totalPages)
out.print(" <a href=\"" + scriptName + "?pageno=" + (currPage + 1) + "\">Next ></a>");
out.print("</p>");
I'm sure there is a more elegant solution out there. I believe that the standard taglib has some tags which can do this for you. Hopefully someone can confirm this can possibly provide further details.
Hope this helps :)

Similar Messages

  • Multiple paged report

    Hi, I am somehow new to SAP CR for VS2010 and I am trying to create a report that is divided in 3 pages with data in each page related to the previous page. How can i create a multiple paged report? What i want to do is something like this.
    ======will be printed in page 1==========            =======will be printed in page 2====             ===========will be printed in page 3=====
    Rec no. Employee name EmpID Gross income   |      Basic Salary    Bonus  Compensation     |          Exemption code      Tax withheld      Tax due
    1            Peter parker      0001      $5,0000         |         $450               $200        $2.50           |                M1                           $50              $60
    2            Emma stone   0002      $15,000           |         $500                $350       $10              |                S3                            $80              $55
    this is just a sample data/field needed in each page. I tried using section expert and inserted another section under details but it does not give me what i want. TIA.

    Yes, but this is going to be a bit tricky.
    1.  Create a formula called "InitPage":
         NumberVar page = 1;
         Place this formula in the report header - it won't display because of the final ";"
    2.  Create another formula called "SetPage":
         NumberVar page;
         if page = 3 then page := 1
         else page := page + 1;
         Place this formula in the page footer.
    3.  Create a formula called "InitRows": (NOTE:  This assumes that your data for each row is using a numeric ID as the key)
         Global NumberVar Array rowInfo := [-1];
         1;  //formulas cannot return an array, so we give it a meaningless value to return
         Place this formula in the report header.
    4.  Create a formula called "ClearRows":
         EvaluateAfter({@SetPage});
         Global NumberVar Array rowInfo;
         NumberVar page;
         if page = 1 then
              Redim rowInfo[1];
              rowInfo[1] := -1;
         1;
         Place this in the page footer below the {@SetPage} formula.
    5.  Create a formula called "SetRow":
         Global NumberVar Array rowInfo;
         NumberVar page;
         if page = 1 then
              if not ({MyTable.ID} in rowInfo) then
                  if rowInfo[1] = -1 then
                        rowInfo[1] := {MyTable.ID}
                  else
                       //Add one element to the array.
                       Redim Preserve rowInfo[UBound(rowInfo) + 1];
                       //Set the element to the value you need for linking the data.
                       rowInfo[UBound(rowInfo)] := {MyTable.ID}
         1;
         Place this formula in your details section - it won't show anything, but it will set up the array for use in the subreports.
    6.  Keep your subreports in the details sections as they are.
    7.  In the Section Expert, do the following:
         a.  Turn off "New Page After" on the first details section.
         b.  For the second details section, set the Suppress formula to:
                   NumberVar page;
                   page <> 2
         c.  For the third details section, set the Suppress formula to:
                   NumberVar page;
                   page < 3
    7.  In your subreport, create a Formula called "FilterArray":
         Global NumberVar Array rowInfo
         Note that there is NO semi-colon on the end of this!
    8.  In the Select Expert, edit the selection formula to add something like this:
         {MyTable.ID} in {@FilterArray}
    I haven't tested any of this other than to make sure that Crystal will verify the formulas.  But, it should get you close to what you're looking for.
    -Dell

  • Crystal report -How to display multiple lines in line chart?

    Hi,
    M struggling to display multiple lines in line chart. All the values m fetching it from database into data table in below format & data type
    Category(String).....year(Int).....graph_values(Int).....table_value(String)
    Test.........................2006.......... -100............................(100)
    Avg..........................2006..........20................................20
    Median......................2006...........5................................5
    Test..........................2007...........500.............................500
    Avg...........................2007............90..............................90
    Median.......................2007............45..............................45
    M using cross tab to display data and chart to plot line. Following fields I used in Cross tab Expert & Chart expert
    Cross tab expert-
    Rows u2013 category
    Columns u2013 year
    Summarized fields u2013 Min of table_value
    In Chart Expert u2013
    On Change of - Year
    Show values - graph values
    In cross tab m able to see the data properly but not in graph.I have three categories. Hence it should plot three lines in line chart but m able to see only one line for test category.
    FYI u2013 using VS 2008 and crystal report assembly version 10.5
    Urgent. Please reply soon.
    Thanks
    ThakurS

    I got the solution.
    In Chart Expert - I should use
    On Change of -- Year, Category
    Show values -- graph values
    Thanks,
    ThakurS

  • Display specific row to display multiple time in jsf table 11.1.1.2.0 with

    HI ALL,
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I have to display the values in jsf frm table where i'm using DislayCertDetailVO . In dis VO i'm having a column no.of certificaties .taking dis column value when i navigate to other page jsf by selecting a specific row. here i have to display the selected row in multiple times based on the no.of.certificates column value.
    I want to display specific row to display multiple time to repeat same row in a table in jsf based on the value from bean or table in database.
    Edited by: user9010551 on Apr 28, 2010 6:14 AM
    Edited by: user9010551 on Apr 28, 2010 10:33 PM

    Hi, Trying it once more to give more clarity of my scenario.
    I have to navigate from 1 screen to the other by picking a given table record/row from the 1st screen. While displaying the record on the 2nd screen the catch is that, I have to display it as many times as the value in a cell of the selected record.
    eg.
    screen 1
    col1   col2     col3
    2 order1 item1
    [next]
    On clicking next it should look like
    screen2
    col1           col2            col3           col4
    order1 item1
    order1 item1
    where col3 and col4 will be editable by the user and col1 is the value depends how many times i have repeat the row/record
    Hope this give more clarity.

  • How to Display multiple records in Table in VC without using BAPI.

    Hi All,
    I am working on Visual composer (NW2004s SP10). I am trying to display Poitems from BAPI_PO_GETDETAIL. I am creating my front end using VC. I have created one form and one Table where I want to display POItems. I am writing my logic of retrieving data from BAPI in CAF.I am connecting them in Guided procedures.When I run my process in Guided Procedures I am getting single row displayed in table. Can Anyone help me how to display multiple rows in table.
    Regards,
    Sheetal

    Hi Sheetal,
    if the BAPI returns a table, then you get multiple rows. From which system is the BAPI, so that I can check the BAPI to give you further information.
    Best Regards,
    marcel

  • How to display multiple reports at the same time

    Hi,
    I'm trying to display multiple reports at the same time, each one in separates tabs or windows using Forms 11g 11.1.1.6
    I have a button which has a call to a procedure which makes use of rp2rro library to show the specific reports, for example:
    call_report('report1');
    call_report('report2');
    call_report('report3');
    call_report('report4');
    The main problem is that, just the last report is been displayed.
    Is there some way to display report1, report2 etc in separate tabs or windows ??
    Regards
    Carlos

    You shouldn't have a problem calling different reports at once. As long as you're using Forms 11g they show up in different windows.
    The question is how you are calling the report.
    Here is how I manipulate it.
    After I pass parameters with the ADD_PARAMETER built-in I set some key values (destype, desformat, desname) with the RP2RRO's procedures.
    Finally calling RP2RRO.RP2RRO_RUN_PRODUCT and then WEB.SHOW_DOCUMENT passing the correct procedure parameters the report comes up in a window. If you repeat the above changing the appropriate variables (the report_name in the RP2RRO_RUN_PRODUCT and so on) you can get multiple reports in different windows.

  • How to integrate bing map for including or displaying multiple locations at the same time

    how to integrate bing map for including or displaying multiple locations at the same time

    Have you aware of the geolocation field that's been introduced with SharePoint 2013?  You can store location data within a list and then integrate this within Bing.  The second tutorial on this Bing team blog will show it well.
    https://www.bing.com/blogs/site_blogs/b/maps/archive/2013/03/26/connecting-a-sharepoint-list-to-bing-maps.aspx
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • How to display multiple lines in a text box defined in  steploop.

    Hi,
    I have a requirement to display data ( which is dynamic in nature. I determine data type,length etc dynamically) in a table format. I am using step loop for the same. I am facing a problem. Some field can be as long as 256 char long. Is there  any way to display multiple lines in text box defined in a step loop so that I can display the complete string as one entity.
    I can't use custom control as custom control can't be defined in a step loop or table controlI would really appreciate your help on this.
    Regards,
    Sanjeev

    Hello Sanjeev
    Perhaps it is possible to use a <b>mixed strategy</b> consisting of a classical table control (or, even better, an ALV grid list) where you display the first 250 character of the data and next to the table control you place a simple textedit control. When the user selects one of the text fragments in the table control the entire text will be displayed in the textedit control.
    Regards
      Uwe

  • How to display multiple categories of webapp items in list view? Changing listbox list to checkbox list to select category in submission process?

    Hello!
    1.
    I am trying to get my page to list webapp items that are part of a few categories. I understand that if i want to view only one category, I just need to do the normal process of choosing that category and placing it out. So my question is: How do I display multiple categories of items in a webapp in a single page. I've tried this
    {module_webapps,WEBAPP_ID,c,CATEGORY_ID1,,,,10,,1} {module_webapps,WEBAPP_ID,c,CATEGORY_ID2,,,,10,,1}
    This only displays the everything from the first category, then everything from the next, which will not make it in order of date.
    I've also tried this for fun:
    {module_webapps,WEBAPP_ID,c,CATEGORY_ID1&CATEGORY_ID2,,,,10,,1}
    How can I go about doing it?
    2.
    I am looking to allow users to input a webapp item and allow them to select a category to tie to that item.
    <label for="CAT_Category">Category (You may select more than 1)<span class="req">*</span></label>
        <select name="CAT_Category" id="CAT_Category" class="cat_listbox" rows="4" multiple="multiple" style="height: 60px;">
        <option value="CATEGORY_ID1">--- Option 1</option>
        <option value="CATEGORY_ID2">--- Option 2</option>
        </select>
    Is it possible for me to change the listbox style into a checkbox style such that the user doesn't have to control+click multiple options?

    No answer to No.1 but I really want to find it out too.
    No.2 
    If you already know list of the categories & ID you can manually create a list of checkboxes
    <input type="checkbox" name="CAT_Category" value="89081" />
    <input type="checkbox" name="CAT_Category" value="89082" />
    <input type="checkbox" name="CAT_Category" value="89083" />
    something like that should work

  • Is there a way to display multiple iPad screens on the same television screen simultaneously?

    Is there a way to display multiple iPad screens on the same television set concurrently?  The idea is to let multiple individuals do something on their iPads in a timed window and then display the results of each iPad users answer concurrently on te same television.

    Devices that display two, four, or even eight video signals on a single monitor are available in the video security market. Maybe you could find something there that would do what you want. A quick search on "security tv screen multiplexor" (without the quotes) yielded millions of pages; several on the first page looked promising if you don't mind composite video.

  • Load and Display Multiple Images in a Web Dynpro Table

    I am new to Web Dynpro and I am wondering if anyone can help me with an application that I am currently developing. I have a particular requirement to store images in a database table (not MIME repository) and then display them in a WD table element. An image can be of JPEG, PNG or TIFF format and is associated with an employee record.
    I want to create a view in my application that displays multiple images in a table, one image per row. I want to do this using Web Dynpro for ABAP, not Java. I have looked into pretty much all examples available for Web Dynpro and came to the conclusion that Components such as WDR_TEST_EVENTS and WDR_TEST_UI_ELEMENTS do not have any examples of images being stored in a database table and viewed in/from a Web Dynpro table element. Programs such as RSDEMO_PICTURE_CONTROL, DEMO_PICTURE_CONTROL and SAP_PICTURE_DEMO do not show this either.
    The images to be displayed in the Dynpro table are to come from a z-type table, stored in a column of data type XSTRING (RAW STRING). So I would also like to know how to upload these images into this z-type table using ABAP code (not Java).
    Your help would be greatly appreciated.
    Kenn

    Hi,
    May be this is the is the correct place to post your query.
    Web Dynpro ABAP
    Regards,
    Swarna Munukoti.
    Edited by: Swarna Munukoti on Jul 16, 2009 3:52 PM

  • Need help in displaying multiple attachments in a OAF Page

    Hi,
    I need to display attachemts of requisition line in a OAF Page(Notification Detials Page)and the attachments can be more than one.My custom VO returns it as a single string like url1, url2.. etc.
    I need to show them as seperate links.
    I tried using the Item Style as LINK.But it is not working.It is prefixing the server url before the View Attribute and creating a single link.
    Any help in this regard will be appreciated.Thanks in advance.
    Srini

    Hi skeerthi,
    If you are using the core attachments table (FND_ATTACHED_DOCUMENTS and the like), you can have a look on the Developer's Guide on chapter 4: Implementing Specific UI Features, section "Attachments", there is a seeded region available for displaying multiple attachments.
    If you are not, then i'd recommend refactoring :D... Just kidding, it would be nice to use the core feature, but if the table is custom, and the links are stored separated by commas, you will have to write controller code to implement that. That can be done by:
    1) Creating an Application module method that uses StringTokenizer to tokenize the attribute String (use getViewObject().getCurrentRow().getAttribute() to get the comma-separated value) and return that to the controller
    2) In the controller, receive the StringTokenizer and for each token, use the api createWebBean() to create an OALinkBean and add it to a layout region using addIndexedChild() api.
    This way you will dinamically create a Link for each attachment. If your layout region is, for example, tableLayout, you can create a rowLayout for each token, then create a Link, add the link to the row layout and finally add it to the tableLayout. By doing so, you will create a table-style attachment region.
    Hope it Helps
    Thiago

  • How to display multiple attachments in UWL item in portal?

    HI,
    How to display multiple attachments in UWL item in portal?
    I want to display more than one attachment in UWL body,present its dispalying one attachment.
    Pls help on this
    Thanks,
    Bheem
    Edited by: v bheem on Aug 4, 2009 3:10 PM

    Hi,
    Are you able to manage this! Pls do let us know if you have done any configuration changes!

  • Displaying Multiple Values on GUI components - best way to implement

    Hi,
    my program needs to implement a basic function that most commercial programs use very widely: If the program requires that a GUI component (say a JTextField) needs to display multiple values it either goes <blank> or say something more meaningfull like "multiple values". What is the best way of implementing it?
    In particular:
    My data is a class called "Student" that among other things has a field for the student name, like: protected String name; and the usual accessor methods (getName, setName) for it.
    Assuming that the above data (i.e. Student objects) is stored in a ListModel and the user can select multiple "Students", if a JTextField is required to display the user selection (blank for multiple selections, or the student "name" for a single selection), what is the best (OO) way of implementing it? Is there any design pattern (best practice) for this basic piece of functionality? A crude way is to have the JTextField check and compare all the time the user selections one by one, but I'm sure there must be a more OO/better approach.
    Any ideas much appreciated.
    Kyri.

    Ok, I will focus on building a solution on 12c.
    right now I have used a USER_DATASTORE with a procedure to glue all the field together in one document.
    This works fine for the search.
    I have created a dummy table on which the index is created and also has an extra field which contains the key related to all the tables.
    So, I have the following tables:
    dummy_search
    contracts
    contract_ref
    person_data
    nac_data
    and some other tables...
    the current design is:
    the index is on dummy_search.
    When we update contracts table a trigger will update dummy_search.
    same configuration for the other tables.
    Now we see locking issues when having a lot of updates on these tables as the same time.
    What is you advice for this situation?
    Thanks,
    Edward

  • How to extend MobileIconItemRenderer to display multiple lines of text?

    Hi,
    I am using Flex hero which has the added Mobile APIs.
    Has anyone been able to extend the MobileIconItemRenderer to display multiple lines of text.
    The current version of the MobileIconItemRenderer only displays 4 things: an image on the left, a label on the top to the right of the image , a message below the lable, which could be a sentence that can take multiple lines and an icon on the right.
    So I would like to replace the messageField content with multiple single lines , one after the other.
    Has anyone does this?
    Otherwise, i suppose I would have to implement my own ItemRenderer if I want to customize the location of the components inside the item?
    thank you

    Hi,
    I am using Flex hero which has the added Mobile APIs.
    Has anyone been able to extend the MobileIconItemRenderer to display multiple lines of text.
    The current version of the MobileIconItemRenderer only displays 4 things: an image on the left, a label on the top to the right of the image , a message below the lable, which could be a sentence that can take multiple lines and an icon on the right.
    So I would like to replace the messageField content with multiple single lines , one after the other.
    Has anyone does this?
    Otherwise, i suppose I would have to implement my own ItemRenderer if I want to customize the location of the components inside the item?
    thank you

Maybe you are looking for