Pagination in toplink using custom query

Re: Pagination using TopLink
Posted: Aug 31, 2006 10:42 PM in response to: Shaun Smith Reply
Hi,
I have my own customer query which is really complex with subqueries,joins,grouping,aggregation in the query etc etc for which I cant use toplink workbench to create a project and do the metadata mapping.
But we need to enable pagination without holding the database resources between customer's page time in the browser.
Is there any provision in toplink to just input the custom query (either statement/prepared statement) and do pagination without holding connection to the database between page time?
The example i got from the link makes use of LogicalCursor/ChunkingLogicalCursor etc.
LogicalCursor cursor = new LogicalCursor(Model.class,null);
for (CursorIterator it = cursor.iterator(session); it.hasNext();)
System.out.println(it.next(session));
Only parameter that is passed to the LogicalCursor is "Model" which is a java object mapped to a particular table.
But we had a java object which should be mapped to the output of a complex query involing complex query and pagination needs to be enabled.
Could you please let us know a sample by which we can do by simply passing the query during the runtime ?

It really seems weird.
We followed the toplink tutorial and wrote a servlet FindAddress which on receiving the request
1. instantiates ReadQuery and
2. setreferenceclass to Address.class,
3. setFetchSize(1000) and
4.sets useScrollableCursor.
5. It does session.executeQuery returning a ScrollableCursor.
6. We place the ScrollableCursor in HttpSession
and then redirect the page to viewAddress.jsp which
1. retrieves the ScrollableCursor from the session
2. i=0;     while(cursor.hasNext() && i<1000) {
     Address address = (Address)cursor.next();
//display via the jsp all these 1000 address objects
3. has a next button when a click on that it again goes to the same page retrieving the next set of 1000 records from ScrollableCursor from the session.
Through out this experimentation I could see the connection is still held. I was expecting that once the page gets displayed for 1000 records and untill you press next, the connection should be handled back to the J2EE application server but still the connection is held .
The logic of setFetchSize as mentioned in the documentation is that after reading the first set of records as per fetchSize ,connection should be returned to the pool and when we do iterator.next() after fetchsize limit, it has to again going to the database and fetch records but it doesnt seem to be.
Could you please help us. This is what we are trying to do as next step and we had been evaluating toplink could be the best choice for our business scneario:
We try to achieve pagination without holding the database resource when the user navigates between paged records.
Any help on this would make us to hit toplink for our huge application.
Here is the attached FindAddress.java and ViewAddress.jsp
FindAddress.java
=============
// Decompiled by DJ v2.9.9.61 Copyright 2000 Atanas Neshkov Date: 9/8/2006 6:32:21 PM
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: FindAddress.java
package examples.servletjsp;
import java.io.IOException;
import java.io.PrintStream;
import javax.servlet.*;
import javax.servlet.http.*;
import oracle.toplink.expressions.Expression;
import oracle.toplink.expressions.ExpressionBuilder;
import oracle.toplink.queryframework.ReadAllQuery;
import oracle.toplink.queryframework.ScrollableCursor;
import oracle.toplink.threetier.ClientSession;
import oracle.toplink.threetier.Server;
// Referenced classes of package examples.servletjsp:
// JSPDemoServlet
public class FindAddress extends JSPDemoServlet
public FindAddress()
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
doPost(request, response);
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
request.setCharacterEncoding("UTF-8");
getServletContext().log("FindAddress servlet - doPost");
java.util.Vector address = null;
ScrollableCursor cursor = null;
try
HttpSession session = request.getSession(true);
ReadAllQuery query = new ReadAllQuery();
query.setReferenceClass(examples.servletjsp.model.Address.class);
ExpressionBuilder builder = new ExpressionBuilder();
query.setSelectionCriteria(builder.get("id").greaterThan(100));
query.setFetchSize(5000);
query.useScrollableCursor();
System.out.println("########### Sleep Mode Before assigning to CURSOR ###############");
System.out.println("############ Back from Sleep Mode before CURSOR ############");
cursor = (ScrollableCursor)((Server)getSession()).acquireClientSession().executeQuery(query);
System.out.println("############ Sleep Mode After assigning to CURSOR ###########");
System.out.println("############ Back from Sleep Mode After CURSOR ############");
session.setAttribute("ScrollableCursor", cursor);
catch(Exception e)
request.setAttribute("source", "FindEmployees doPost");
request.setAttribute("header", "An Error Occurred");
request.setAttribute("errorMessage", e.getMessage());
request.getRequestDispatcher("./errorPage.jsp").forward(request, response);
return;
System.out.println("cursor------------" + (cursor == null));
if(cursor == null)
request.getRequestDispatcher("./EmployeesNotFound.jsp").forward(request, response);
} else
request.setAttribute("address", address);
request.getRequestDispatcher("./viewAddress.jsp").forward(request, response);
viewAddress.jsp
=============
<%@page import="java.util.*"%>
<%@page import="examples.servletjsp.*"%>
<%@page import="examples.servletjsp.model.*"%>
<%@page import="oracle.toplink.queryframework.ScrollableCursor"%>
<%@page import="java.math.*"%>
<%@page contentType = "text/html; charset=UTF-8"%>
<html>
<head><title>Employee Query Results</title></head>
<body>
<form name="test" method="post" action="viewAddress.jsp">
<!--      Prepare s heading.
     Get the employees passed in from ViewEmployees servlet. Show them in table format. Provide button
     to ViewEmployee -->
<%
     request.setCharacterEncoding("UTF-8");
     String searchString = request.getParameter("employeeString");
     ScrollableCursor cursor = (ScrollableCursor) session.getAttribute("ScrollableCursor");
     String heading = null;
          heading="Search Results for FindAll on Employee";
     String employeeData = "";
     //Iterator data = ((Vector)request.getAttribute("address")).iterator();
     int i =0;
     while(cursor.hasNext() && i<4995) {
          if(i<10){
               System.out.println("######### JSP Count TRhread Sleep ###########");
               //Thread.sleep(100);
               //System.out.println("######### JSP Count TRhread Sleep Over ###########");
          i++;
     Address address = (Address)cursor.next();
     BigDecimal id = address.getId();
     String city = address.getCity();
     String province = address.getProvince();
     String street = address.getStreet();
     String country = address.getCountry();
     String pCode = address.getPostalCode();
     employeeData += "<tr><td>" + id + "</td>"
          + "<td>" + province + "</td>"
          + "<td>" + street + "</td>"
          + "<td>" + city + "</td>"
          + "<td>" + pCode + "</td>"
          + "<td>" + country+ "</td>"
          + "</tr>";
     //cursor.close();
     System.out.println("abcdAfter closing the cursor ->plz see whether connpool monitorcnt = 0");
%>
<center>
     <h2><%=heading%></h2>
     <hr>
     Return to Main
     <p>
     <table border=1>
          <tr>
               <td align="center">Address Id</td>
               <td align="center">Province</td>
               <td align="center">Street</td>
               <td align="center">City</td>
               <td align="center">Postal Code</td>
               <td align="center">Country</td></tr>
          <%=employeeData %>
     </table>
</center>
<p>
<input type="submit" name ="next" value="next" >
<center>Return to Main</center>
</form>
</body>
</html>

Similar Messages

  • Can I use custom query in DB Adapter with Polling

    Hi All,
    I am getting problem while using db adapter with polling. Can I use custom query in db adapter with polling.
    I am using 2 tables; table 1 and table2
    Structure of table1 is as:
    File_name
    Batch_id
    Creation_date
    Status
    Structure of table2 is as:
    Batch_id
    Employee_ID
    Last_Name
    First_Name
    Middle_Name
    Group_ID
    Site_ID
    Dept_Num
    Report_id
    I have to use below query while polling to table1
    Select count(*) as NOSEXP, Report_id
    from table1, table2
    where table2.batch_id =
    table2.batch_id
    and table1.Status= 0
    group by Report_id;
    I mean, when I use DB adapter to poll table1, I have to use above query.
    Can you Please suggest on this.
    Thanks in advance.

    I will check for existance not based on Primary key but based on three other fields in the table. I think , by default DB adapter configured for MERGE checks for existance based on PK. Can we change the Primary Key in the mapping file after the DB adapter is configured. In that case , will it check for existance based on the fields , I mention.
    Edited by: user12020809 on Sep 16, 2012 6:08 PM

  • Use custom query script webi

    Hello,
    I have created an SQL query to MS SQL Server. I want this query to run for my results at webi reports. When I copy this query, I validate it without errors, but afer saving it, the webi losses it and has the query created by the tool. How can I make the webi run this custom query?
    Thanks

    What is your BO version ?
    Did you check the below SAP KBAs ?
    1761949 - Custom SQL is being lost when editing Webi document
    1812889 - Custom SQL dissapears and reverts to the generated SQL after cancelling the prompt window when refreshing a WebIntelligence report

  • Error  While Polling Database changes using Custom SQL

    Hi,
    I am using Oralce SOA Suite 11g DbAdapter for polling Database changes.
    My source database is DB2,I am using custom query for polling the changes in source database.
    I am using "Update an External Sequencing Table on a Different Database" polling Strategy
    Query section of the Mapping file is as follows.
    <querying xsi:type="query-policy">
    <queries>
    <query name="ReceiveF554102TXEDataSelect" xsi:type="read-all-query">
    <call xsi:type="sql-call">
    <sql><![CDATA[SELECT FILE_NAME, LIBRARY_NAME,
                   USER_NAME, SEQUENCE_NUM,
                   JOURNAL_CODE, ENTRY_TYPE, TIME_STAMP, JOB_NAME, JOB_USER,
                   JOB_NUMBER, PROGRAM_NAME, ARM_NUMBER, ADDRESS_FAMILY, RMT_ADDRESS,
                   REMOTE_PORT, SYSTEM_NAME, REL_RECORD, OTRCLN, IBMCU, IBITM, IBLITM,
                   IBAITM, IBY55ETAFR, IBY55ETATH, IBY55NUM01, IBY55NUM02, IBY55NUM03,
                   IBY55NUM04, IBY55NUM05, IBY55NUM06, IBY55NUM07, IBY55NUM08,
                   IBY55NUM09, IBY55NUM10, IBELM01, IBELM02, IBELM03, IBELM04, IBELM05, IBY55STR01,
                   IBY55STR02, IBY55STR03, IBY55STR04, IBY55STR05, IBY55CHA01,
                   IBY55CHA02, IBY55CHA03, IBY55CHA04, IBY55CHA05, IBY55DAT01, IBY55DAT02,
                   IBY55DAT03, IBY55DAT04, IBY55DAT05, IBUSER, IBPID, IBJOBN, IBUPMT,
                   IBUPMJ FROM PY_JRNMON.F554102T WHERE ((TIME_STAMP > (SELECT LAST_READ_DATE FROM SOALIB.SOASEQHDR WHERE (TABLE_NAME = 'F554102T'))) AND (TIME_STAMP < SYSDATE)) ORDER BY TIME_STAMP ASC]]> </sql>
    </call>
    <reference-class>ReceiveF554102TXEData.F554102T</reference-class>
    <lock-mode>none</lock-mode>
    <container xsi:type="list-container-policy">
    <collection-type>java.util.Vector</collection-type>
    </container>
    </query>
    </queries>
    <delete-query xsi:type="delete-object-query">
    <call xsi:type="sql-call">
    <sql>UPDATE SOALIB.SOASEQHDR SET LAST_READ_DATE = #LAST_READ_DATE WHERE (TABLE_NAME = 'F554102T')</sql>
    </call>
    </delete-query>
    </querying>
    I am getting following Error after defining the custom SQL in my mapping.xml file. (After executing the Created Process)
    Caused by: BINDING.JCA-11622
    Could not create/access the TopLink Session.
    This session is used to connect to the datastore.
    Caused by BINDING.JCA-11626
    Query Not Found Exception.
    Could not find Named Query [ReceiveSampleCustomPollSelect] with ? arguments, belonging to Descriptor [ReceiveSampleCustomPoll.F554102T] for [oracle.tip.adapter.db.DBActivationSpec@2ec733b0] inside of mappings xml file: [ReceiveSampleCustomPoll-or-mappings.xml].
    You may have changed the queryName info in either the _db.jca or toplink-mappings.xml files so that they no longer match.
    Make sure that the queryName in the activation/interactionSpec and in the Mappings.xml file match. If an old version of the descriptor has been loaded by the database adapter, you may need to bounce the app server. If the same descriptor is described in two separate Mappings.xml files, make sure both versions include this named query.
    You may need to configure the connection settings in the deployment descriptor (i.e. DbAdapter.rar#META-INF/weblogic-ra.xml) and restart the server. This exception is considered not retriable, likely due to a modelling mistake. This polling process will shut down, unless the fault is related to processing a particular row, in which case polling will continue but the row will be rejected (faulted).
         at oracle.tip.adapter.db.exceptions.DBResourceException.createNonRetriableException(DBResourceException.java:653)
         at oracle.tip.adapter.db.exceptions.DBResourceException.createEISException(DBResourceException.java:619)
         at oracle.tip.adapter.db.exceptions.DBResourceException.couldNotCreateTopLinkSessionException(DBResourceException.java:291)
         at oracle.tip.adapter.db.DBManagedConnectionFactory.acquireSession(DBManagedConnectionFactory.java:883)
         at oracle.tip.adapter.db.transaction.DBTransaction.getSession(DBTransaction.java:375)
         at oracle.tip.adapter.db.DBConnection.getSession(DBConnection.java:266)
         at oracle.tip.adapter.db.InboundWork.init(InboundWork.java:322)
         at oracle.tip.adapter.db.InboundWork.run(InboundWork.java:526)
         ... 4 more
    Caused by: BINDING.JCA-11626
    Query Not Found Exception.
    Could not find Named Query [ReceiveSampleCustomPollSelect] with ? arguments, belonging to Descriptor [ReceiveSampleCustomPoll.F554102T] for [oracle.tip.adapter.db.DBActivationSpec@2ec733b0] inside of mappings xml file: [ReceiveSampleCustomPoll-or-mappings.xml].
    You may have changed the queryName info in either the _db.jca or toplink-mappings.xml files so that they no longer match.
    Make sure that the queryName in the activation/interactionSpec and in the Mappings.xml file match. If an old version of the descriptor has been loaded by the database adapter, you may need to bounce the app server. If the same descriptor is described in two separate Mappings.xml files, make sure both versions include this named query.
         at oracle.tip.adapter.db.exceptions.DBResourceException.queryNotFoundException(DBResourceException.java:694)
         at oracle.tip.adapter.db.ox.TopLinkXMLProjectInitializer.initializeQuery(TopLinkXMLProjectInitializer.java:1238)
         at oracle.tip.adapter.db.DBManagedConnectionFactory.acquireSession(DBManagedConnectionFactory.java:728)
         ... 8 more
    Help required to fit custom SQL in mapping.xml file for complex queries.
    Thanks,
    Arun Jadhav.

    "Execuite Custom SQL" in DB adapter and you'l get it.
    But in this case you'll have to implement your own polling strategy (if you need one).
    If you want to use one of the predefined polling strategy you should use "Poll for New or Changed records" and import all the tables you use and connect them in wizard.

  • Problem with odata with custom query options

    I have a datasource which uses custom query options
    http://www.odata.org/documentation/odata-version-3-0/url-conventions/#url5.2
    But those query options are not getting sent by Power Query with the $top requests.  Hopefully this is something you will correct in a subsequent release.
     - Chris

    Here's the sequence of calls that Power Query makes:
    GET /odata/catalog/test?$orderby=name&param=70442
    GET /odata/catalog/$metadata
    GET /odata/catalog/test?$orderby=name&$top=1000
    GET /odata/catalog/test?$orderby=name&param=70442
    GET /odata/catalog/$metadata
    GET /odata/catalog/test?$orderby=name
    GET /odata/catalog/test?$orderby=name&param=70442
    The problem, as you can see, is that two of the calls did not include the "param" parameter which is resulting in incorrect behaviour. Is this a bug?
    Thanks,
    Chris

  • Working with Custom SQL Using Descriptor Query Manager Queries

    Hi All,
    I am Working on Descriptor Query Manager Queries
    Configuring Custom SQL Using Java and Workbench
    Using Java I wrote a static method as in the code given below.
    public static void insertEmployee(ClassDescriptor descriptor){
    descriptor.getQueryManager().setInsertSQLString(
    "insert into EMPLOYEE (EMP_ID, EMP_NAME, EMP_JOB, SAL, DEPTNO) values (#EMP_ID, #EMP_NAME, #EMP_JOB, #SAL, #DEPTNO)"
    I wrote a insert SQL Query in the custom SQL tab of the Toplink workbench .
    Using java and Using Toplink Workbench I had a problem how to call this insert query in the sessionEJBBean .
    Can any one suggest me in this regard.
    Thanks in advance
    regards,
    Satish

    What is the problem you are experiencing?
    Normally you can just execute the query by calling
    'executeQuery(queryName, domainclass) on the session.
    See also
    http://www.oracle.com/technology/products/ias/toplink/
    doc/10131/main/_html/qrybas003.htm#BCFIBGGJ
    Just out of curiosity: why do you need a custom SQL
    to insert something? Can't you use persist()?
    regards,
    LonnekeOr even UnitOfWork ? Why go down the route of using custom inserts to insert objects unless you have some business logic that Toplink's UnitOfWork API cannot provide ?

  • How do I...Mimic Replacement Path with Query using Customer Variable Exits?

    Hello SDN:
    We are on BW 3.5 SP16.
    We are currently using a replacement path Query(RP) with variables
    to populate a variable in another Query(T).
    The problem we are having is with performance.
    The entry of variables in replacement path Query(RP) is optional (This is necessary there cannot be required values)
    When results from Replacement Path Query are small performance is fine. (e.g. 10 seconds)
    When results from Replacement path query are large performance suffers. (e.g. 1+ minutes)
    Users are free to leave the replacement path variables empty resulting in a large set of data to be replaced. This is the worst performance case.
    We would like to discover a way to conditionally execute the replacement path query. That is if users do not enter values for the replacement Query(RP) variables do not execute the replacement path query(RP).
    Does anyone know if this is possible within reason and in customer exit space?
    We have reviewed the situation from all angles and the requirement for the replacement path FUNCTIONALITY and the freedom for the user to leave variable values blank remains.
    I've been searching and reading SDN and SAP notes for about a week and do not find threads which address this situation.
    We are also exploring Customer variable exits to mimic replacement path functionality
    (different topic subject="How do I...Mimic Replacement Path with Query using Customer Variable Exits?")
    Any help will be appreciated
    Many thanks
    David Schuh

    My appologies-I posted this message with the wrong subject. I will repost it with appropriate subject.
    dave schuh

  • Crystal Reports with BEx Query using Custom Exit Variable

    Hi,
    We have BW BEx Query using Customer User Exit variable to derive  the Fiscal Week for Last Year (called it VAR2) based on another user input variable Current Fiscal Week (called it VAR1).
    VAR2 is derived from VAR1 in CMOD via some codings and thus it DOES NOT have the "Variable is Ready for Input" flag ticked in the BEx. VAR1 is user input variable, so it has "Variable is Ready for Input" flag ticked in the BEx.
    When we create a Crystal Reports with the BEx Query using variable VAR2, and when we run it we got an error message saying "Failed to execute query; '[]<java.lang.UnsupportedOperationException: No Selection State Support!ZP_MI_LYPUBWEEK>'. Redesign your query or contact the data source maintainer to solve the problem".  (note: ZP_MI_LYPUBWEEK is VAR2 in this case).
    Could anyone please assist? Surely, CR supports BEx customer user exit variables like the above, right?. I also refer to the forum below as it seems to have a similar issue (except mine with an error message), but it does not provide a solution in it.
    Crystal Reports with BEx Query using Custom Exit Variable
    Thanks,
    Andy

    Hi Vibhav,
    We have the SAP Crystal Reports for Enterprise XI4.0 Version 14.0.0. Not sure if SP0 or other SP, got to check with Basis Team later.
    We tried that "mandatory" option and did not work either.
    Anyway, SAP has now come back again saying it is something they will fix it in next release/version. We got a phone call from them and a reply below to our OSS.
    23.08.2011 - 08:20:49 CET - Info for Customer by SAP  
    I have raised this issue on the Idea#s Place as an enhancement request
    on the below link:
    https://cw.sdn.sap.com/cw/ideas/5586
    This ER contains the information of including the customer exit
    variables in the report without checking the #input for ready# option.
    This ER can be considered for being implemented in the future
    versions. You can refer to SAP Note: 1515837 - How To: Enhancement
    Request Process - "Idea Place" for more information regarding the Idea
    Place.
    Cheers,
    Andy

  • How to query a dataset using custom code in report builder 3.0

    Hi,
    Can anyone please suggest whether it is possible to query a dataset by using custom code in report builder 3.0.
    Thanks in advance.

    Hi Purbasha,
    please see below similar thread:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9af8f39a-9dc5-49ab-91af-2f64198c8477/ssrs-2008-custom-code-for-database-query
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/440ff5de-1c21-47de-95d8-e4212d6cef6d/dataset-in-custom-code-in-sql-server-reporting-services?forum=sqlreportingservices
    swallow

  • TopLink doesn't sort data received using Named query

    Hello!
    I'm trying to build a Tree table using a TopLink Named query in my application.
    There are Id, Parent|_Id, Code and Name columns in the corresponding database table, where Id and Parent|_Id are linked together by Foreign key (typical tree). I used TopLink to describe this table in the Model part of my application. There I wrote a Named query, without using a query constructor (not Expression radio button, but SQL radio button). Here the text of query:
    select * from regions a connect by prior a.Id = a.Parent_Id start
    with a.Id is null order by a.Code
    Then I created a Data control and tried to build a JSF page with data based on this query, as tree-table.
    But I discovered the fact, that data under the same node on the same leaf level of the Tree are not sorted by code on the JSF page. For example, data may be situated as follows (Code - Name):
    2. wwwwwwwwwwww
    2.3.kkkkkkkkkkkk
    2.1.fffffffffffffffffffff
    2.2.oooooooooo
    1. qqqqqqqqqqqqqqqq
    1. 2. lllllllllllllllllllllllllllll
    1. 1. hhhhhhhhhhhhhh
    etc.
    I verified this query on other environment (PL/SQL Developer, SQL+), but didn't found such unsorted results anywhere.
    Please, give me an advice to avoid this problem.
    Thanks.

    Hi
    Something to do with TreeMap(TreeSet). I tried with TreeSet but it didn't work. Here is the code :
    In servlet :
    Connection lConnection = getConnection(pRequest);
    String lSQL = "";
    Statement lStatement;
    ResultSet lResultSet;
    Hashtable lLtypeHashtable = new Hashtable();
    lStatement = lConnection.createStatement();
    lSQL = "SELECT RCID,RCMEANING FROM REFERENCECODES WHERE RCDOMAIN = 'LOCATIONTYPE' AND RCROWSTATE > 0 order by RCMEANING";
    lResultSet = lStatement.executeQuery(lSQL);
    while(lResultSet.next())
    String lRcid = lResultSet.getString(1);
    String lRcmeaning = lResultSet.getString(2);
    lLtypeHashtable.put(lRcid.trim(),lRcmeaning.trim());
    if(lResultSet != null) lResultSet.close();
    if(lStatement != null) lStatement.close();
    pRequest.setAttribute("LtypeHashtable",lLtypeHashtable);
    //Below Query is executed when one data from select element is selected
    String lLType = DisplayUtilities.getString(pRequest.getParameter("LType"),true);
    //LType is name of select element in JSP.
    if (lLType != null)
    lSQL = lSQL + " AND " + lUpperCaseFunction + "(LOCATIONTYPE)" +
    " = " + DBUtilities.formatString(lLType.toUpperCase());
    pRequest.setAttribute("rLType",lLType+"");
    In JSp :
    <%
    Hashtable lLtypeHashtable = (Hashtable)request.getAttribute("LtypeHashtable");
    %>
    <TR>
    <TD width="15%"> <div align="left">
    <select name="LType" size="1" >
    <option Value="">< Select ></option>
    <%
    if(lLtypeHashtable != null)
    Enumeration enum = lLtypeHashtable.keys();
    while(enum.hasMoreElements())
    String key = (String)enum.nextElement();
    String value = (String)lLtypeHashtable.get(key);
    String flagBack = "";
    if(key.equals((String)request.getAttribute("rLType")))
    flagBack = "selected";
    %>
    <option Value="<%=key%>" <%=flagBack%>><%=value%></option>
    <%
    %>
    </select></div>
    </TD>
    </TR>
    How should I implement TreeSet?
    Looking forward for an early reply.
    Thanks.

  • How to apply pagination to data bind to asp:Repeater control using Camel Query.

    Hi All,
    I am having a <asp:Repeater> control to which i bind the data from share point list. 
    I want to apply pagination to that data which is bind to Repeater. I am using CAMEL query to get data from list. 
    How can i apply the pagination to this data fetch by camel which is bined to Repeater control.
    Thanks
    amol

    Hi,
    From your description, you might want to use CAML to query the needed items from a SharePoint list, then use a Repeater control to bind to these data with paging allowed.
    If so, here is a solution like this: Use
    CAML to query a collection of items and save them into a
    DataTable object. Then use the PagedDataSource object to achieve the paging for us and associate it to a
    Repeater control.
    Here are two links will provide more details:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/7af4c865-a44a-4ccb-864d-9d834f8b2b87/bind-sharepoint-list-to-asp-repeater?forum=sharepointdevelopment
    http://sharepointdotnetfalls.blogspot.in/2013/07/repeater-control-with-paging-in-share.html
    Best regards
    Patrick Liang
    TechNet Community Support

  • Using Inline Query in BPEL

    Hi All,
    We have requirement to exect the bleow query by not using Custom SQL
    select * from A a where a.x1 not in (select b.x1 from B b).
    Is this possible using simple DBadapter by selecting "*perform an Operation on table*" by modifingt the Toplink in the jdeveloper.
    any help in this highly appreciated.
    Thanks and Regards,
    Nagaraju .D

    Hi,
    You can use "perform an operation on table" and in the 8th Step replace the SQL statement by
    select * from A a where a.x1 not in (select b.x1 from B b)
    Regards,
    Deepak Suri

  • How to specify custom query as well as a selection criteria

    Hi
    I'm struggling to specify a custom select query with variable no. of agruments through toplink.
    The custom query looks like:
    select outer.col1, outer.col2, outer.col3,
    outer.effective_date, outer.capacity_rate, outer.expiry_date, outer.comments, outer.create_date,
    outer.create_user_id, outer.modify_date, outer.modify_user_id, outer.vol_uom_type_code
    from tbl outer,
    ( select max(effective_date) effective_date, col1, col2, col3 from tbl
    where expiry_date is null
    or (trunc(effective_date) >= to_date('01/01/'||to_char(sysdate,'yyyy'), 'dd/mm/yyyy') )
    group by col1, col2, col3
    ) inner
    where outer.col1 = inner.col1
    and outer.col2 = inner.col2
    and outer.col3 = inner.col3
    and trunc(outer.effective_date) = trunc(inner.effective_date)
    My domain class TBL.class is mapped one to one with DB Table TBL.
    With this customer query, I want to add a selection criteria depending upon what is specified on the UI-screen - I can get col1, col2 or a combination of these as search criteria.
    So far I have tried multiple approaches:
    1. Specifying the custom query (without arguments) as a ReadAll Query in toplink descriptor and then using expression builder to add the criteria but this doesn't work as custom ReadAll query gets overridden and i get back all the results from
    TBL which match the criteria specified.
    expFinal = new ExpressionBuilder().get("col1").equal(srchCriteria.getCol1());
    results = (List) getTopLinkTemplate().readAll(TBL.class,expFinal,false);
    2. Using Named Query:
    Toplink doesn't allow me to specify a custom SQL along with a selection criteria - both for the same NamedQuery.
    3. Specifying the DB query in java layer and then adding arguments and argument values. When query is executed, i don't see arguments being added.
    ReadAllQuery query = new ReadAllQuery(TBL.class);
    query.setSQLString(READ_ALL_QUERY);
    ExpressionBuilder exp = new ExpressionBuilder();
    query.addArgument("col1", Long.class);
    Vector vect = new Vector();
    vect.add(srchCriteria.getCol1());
    query.addArgumentValues(vect);
    result = (List) getTopLinkTemplate().executeQuery(query, false);
    Please suggest. Would be great if you could share some code bits.
    Thanks
    Nitin

    Nitin,
    This style of query does require code to apply logic as it is created. If you wish to have this used as a named query you can use a query re-direct so that instead of executing a query we call a method of yours.
    You can setup your named query to use re-direction into a static method as:
            QueryRedirector redirector = new MethodBaseQueryRedirector(QueryRedirectorExample.class, "redirectMethod");
            ReadAllQuery raq = new ReadAllQuery(Employee.class);
            raq.addArgument("FIRST_NAME");
            raq.setRedirector(redirector);
            descriptor.getDescriptorQueryManager().addQuery("findByFirstNameLike", raq);The static method that then gets invoked where you can dynamically create a query looks like:
        public static Object redirectMethod(DatabaseQuery query, Record record, Session session) {
            String firstName = (String)record.get("FIRST_NAME");
            ReadAllQuery raq = new ReadAllQuery(Employee.class);
            if (firstName != null) {
                raq.setSelectionCriteria(raq.getExpressionBuilder().get("firstName").likeIgnoreCase(firstName));           
            return session.executeQuery(raq);
        }Doug

  • How to get data for current week and previous week using customer exit in Bex.

    Hi everyone,
    I have a scenario in which I need to display data for current week and previous week (based on "sy_datum" the program has to calculate current week and previous week) in Bex using  Customer exit. I have created one variable in Bex Query Designer and I have written code for the variable in CMOD. But it is not working fine, (I know that we can do the same by using offset value in Bex). Can some one guide me how to achieve my requirement using customer exit.
    Thanks in Advance,
    G S Ramanjaneyulu.

    Hi krishna,
    Thanks for your quick reply, can you have a look at my code,
    case i_vnam.
    WHEN 'ZPWK_CWK'.
    ranges : pre_week for sy-datum.
    data : start_date type DATS,
           end_date TYPE dats .
    ************FM TO GET FIRST DATE OF CURRENT WEEK ************************
    CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
      EXPORTING
        DATE_IN  = sy-datum
      IMPORTING
        DATE_OUT = start_date.   " WEEK FIRST DATE
    end_date = START_DATE + 6.   " WEEK LAST DATE
    END_DATE   = START_DATE - 1.   " PREVIOUS WEEK END DATE
    START_DATE = START_DATE - 7.   " PREVIOUS WEEK START  DATE
    **********PREVIOUS WEEK DATES IN PRE_WEEK******************
    pre_week-SIGN   = 'I'.
    pre_week-option = 'BT'.
    pre_week-LOW    = START_DATE.
    pre_week-HIGH   = END_DATE.
    APPEND  pre_week.
    CLEAR : START_DATE,END_DATE.
    endcase.
    Regards,
    G S Ramanjaneyulu.

  • How to use power query with sitecatalyst

    Hello,
    I need to use power query to import a table from sitecatalyst. Doing some tests I found that If remove the session from the url that has the report parameters, the app will redirect me to the login page, after entering the company, username and password
    it will load the report page with the data according to my filters.
    When I add the report url on the From Web option, excel does not allow me to add credentials. If I add the login+redirect url it allows me to add user/password but does not load the tables that appear on a regular browser.
    Is it possible to consume sitecatalyst without using Report Builder? If not, how you access the security info after you added the url.
    Thanks.

    To the best of my ability to tell, the right way to use this product from within Power Query would be to use its API. Unfortunately, we don't currently support either of the methods needed to be able to authenticate with the service (OAuth 2.0 and a relatively-custom
    digest-based method). Adding a mechanism to allow use of arbitrary OAuth-protected resources is a fairly high priority for us, and I hope we'll be able to deliver something before mid-2015.
    Scraping the website is very hard to do well -- both from an authentication and from a data discovery perspective.

Maybe you are looking for

  • Adding custom fields to Embedded Search

    Hi All, I have read the post [here|How to add custom fields to Embedded Search; about adding custom fields to Embedded Search. I am looking to add Employee Subgroup for use in Talent Management (specifically the STVN SuccessionPlanning component) and

  • File Sharing over web interface?

    I am trying to figure out a solution. We are an advertising agency that we need to transfter files between our studio and clients (which are mostly PC based and cannot connect to conventional ftp server) so we are looking at creating something like d

  • Reply component on synchronous BPEL process in Oracle SOA

    if there any possibility for returning the result to the client in the middle of a synchronous BPEL process? I put the reply component in the middle of BPEL process, but the client still will wait for the whole process completed. I am wondering how t

  • How do I eliminate a .swf page?

    I made a greeting card through InDesign and exported to a .swf file so it could be viewed interactively (turning pages with the mouse).  Everything is fine except you see 2 pages on first instead of just one.  If you think about how a real greeting c

  • What does applecare's 90-day limited warranty cover?

    ok so recently on august 12 , 2012 i was sitting on the couch on sears.comon my ipad 2 looking at shoes. and then my little brother comes and knocks it out of my hand an it cracks the camera area so i took it to the genious bar and i payed $249 to ec