Adding complicated selections to Eclipse Link CriteriaBuilder ?

Hi all,
Can any body suggest how to add
select case when to_char(trunc(TO_DATE ('03-APR-2015','DD-MM-YYYY'), 'mm'), 'FMDAY') = 'SUNDAY' then to_number(to_char(TO_DATE ('03-APR-2015','DD-MM-YYYY'), 'W'))+1
             else ceil((to_char(TO_DATE ('03-APR-2015','DD-MM-YYYY'), 'dd') + 1 - to_char(next_day(trunc(TO_DATE ('03-APR-2015','DD-MM-YYYY'), 'mm'), 'SUNDAY'), 'dd'))/7)+1
        end week_no
from dual
query to Eclipse Link CriteriaBuilder
i am able to add distinct(to_char(sum(datecolumn,number),'W-MM-YYYY')) like
                        Expression sum = cb.sum(CriteriaQueryUtils.getPath(rt, breakupFields), cb.literal(miliSecToAdd));
                        Expression<String> literal = cb.literal("W-MM-YYYY");
                        Expression<String> functionselectclause = cb.function("TO_CHAR", String.class, sum,literal);
                        return query.select(functionselectclause ).distinct(true).where(p).orderBy(orders);
but need to know how to add case when else to CriteriaBuilder
Thank you
Nagappa

Wrong forum!
Please mark the question ANSWERED and repost it in an Eclipse forum.

Similar Messages

  • Calling Hana Store Procedure thorugh Eclipse link

    Hi,
    Anybody having idea of calling HANA store procedure through Eclipse Link JPA.
    Procedure has Scalar IN Parameter and Table Type as OUT Param:
    CREATE PROCEDURE tree_view (IN  topicid BIGINT,OUT qtree tt_tree)
        LANGUAGE SQLSCRIPT
        READS SQL DATA AS  
    BEGIN
    /// SQL Statements
    END;
    Currently i an calling the procedure as
    entiyManager.getTransaction().begin();
                java.sql.Connection connection = entiyManager.unwrap(java.sql.Connection.class);
                connection.setAutoCommit(false);
                CallableStatement cst = connection.prepareCall("call _SYS_BIC.\"workspace.procedures/tree_view\"(?,?)");
                cst.setLong(1, identifier);
                cst.execute();
                ResultSet rs =  cst.getResultSet();
         entiyManager.getTransaction().commit();
    But need more cleaned way like using StoreProcedureQuery or PLSQLStoredProcedureCall.

    Slightly missed the point.
    The question was about providing an INPUT variable.
    An in fact it is not possible to call a procedure with an table type input variable from the SQL console.
    You have to build a wrapper to call such a procedure:
    create type myusers as table (user_name nvarchar(60));
    create procedure count_users (IN user_tab myusers, OUT user_count bigint )
    language sqlscript
    as
    begin
        select count(*) into user_count from :user_tab;
    end;
    call count_users (? , ?)
    Could not execute 'call count_users (? , ?)' .
    SAP DBTech JDBC: [7]: feature not supported:
    Parameterized input table parameter is not allowed: line 1 col 19 (at pos 18)
    A wrapper for this could look like this:
    create procedure call_cu (out user_count bigint)
    language sqlscript
    as
    begin
        v_users = select user_name from users;
        call count_users (:v_users, :user_count);
    end;
    call call_cu (?)
    --> 28
    Unlike SQL*Plus for PL/SQL, the SQL console of SAP HANA is not a SQL Script runtime shell.
    - Lars

  • Archiving: adding more selection criterias for MM_EKKO

    Is there a possibility for adding new selection criterias for object MM_EKKO? Any exits for Release 4.6c?

    Deactivated means that you have executed a 2-step archiving.
    You have different residence times. SAP set the deletion flag if residence time one is met, but residence time 2 not yet.
    If both times are met, the PO gets archived.
    for examples see OSS note 948493 - Residence time in new reports RM06EV47, RM06BV47
    You probably have customized the test variant for MM_EKKO as production variant, other wise SAP would not have updated your database.

  • Selection Tools (Polygonal Lasso, Pen Tool) adding extra selections

    Ok, so I'm having a weird problem in Photoshop CS4 for Mac OS X on 10.6.3. When I try to make a selection and complete the selection Photoshop is just randomly adding extra selections. Here is an example:
    Above, I made a pretty straight-forward selection with the Pen Tool, nothing fancy or anything.
    And then, when I right-click and Make Selection I get this crazy selection above that is no where near what I had originally selected.
    It does this with the Polygonal Lasso Tool as well. I've tried reseting the tools, restarting Photoshop, and restarting the whole Mac and the problem won't go away and now it's starting to drive me crazy.
    Anyone have any idea on what is causing this and how to fix it? Please and thanks!

    I wasn't sure how to search for the problem, and anything I did find didn't offer a solution. If you could point me to some of these posts that would be awesome.  Thanks.

  • I updated Firefox and now, when I select File, Send Link, a dialog box pops up asking me to establish a new account before I can send the link via email.

    I updated Firefox and now, when I select File, Send Link, a dialog box pops up asking me to establish a new account before I can send the link via email. I use Outlook, so how do I avoid setting up some new account and yet am able to send the link via Outlook?
    I have a feeling it may have something to do with HotMail.com.

    My Error: I found out that it was Mozilla Thunderbird that was causing the problem. I uninstalled it and the problem went away.

  • The way to open 3D pdf with specific model selection from url link

    I guess this feature is not supported, but let me ask one thing.
    I am looking for the way to open 3D pdf with specific model selection from url link.
    For example, if the following link is opened, is it possoble to open 3d.pdf with automatic selection of "abc" model in the model tree? 
    http://example.org/3d.pdf#model=abc
    If it can be done by javascript, it's really helpful.

    Impossible. There are only very limited command-line options for the Acrobat Family and you cannot change them.

  • Report with select list and link to call another report

    Hi,
    I am trying to do 2 reports (REPORT1 and REPORT2).
    The first is a summary report (REPORT1).
    This report will display sales figures for the year. Now, I need to have a select list in the result set that will have 2 options, depending on which option is chosen, I want to call REPORT2 with the select list as a parameter. How can I do this ?
    Let me try to explain what I did.
    I created REPORT1 on Page 100
    SELECT YEAR, sum(YTD_SALES), APEX_ITEM.SELECT_LIST(1,'DEPARTMENT','Department;DEPARTMENT,Division;DIVISION') Drilldown FROM SALES_ANALYSIS WHERE YEAR > 2000
    GROUP BY YEAR ORDER BY YEAR
    I created 2 hidden items namely P100_YEAR and P100_DRILLDOWN
    I also made the column YEAR as a link and specified both P100_YEAR and P100_DRILLDOWN as parameters to be passed.
    Next, I created REPORT2
    SELECT YEAR, DECODE(:P100_DRILLDOWN, 'Department', department, 'Division', Division) dept_div, sum(YTD_SALES) ytd_sales
    FROM SALES_ANALYSIS
    WHERE YEAR = :P100_YEAR
    When I run Report 1, it's fine, when I choose either Department or Division from the Select List and click on the link to call Report 2, report 2 is displayed, but the value being passed for P100_DRILLDOWN is not correct and as a result, I am unable to get correct results for Report 2
    Am I missing something ? Are there any alternate ways to do what I'm doing ?
    Thanks,
    Ashok

    Hi Ashok,
    The link definition will not know the value selected in the list as it is constructed only when the page is being rendered. You would need to create some javascript to handle this. I've done that here: [http://apex.oracle.com/pls/otn/f?p=267:182]
    The link on the EMPNO column has been defined in the HTML Expression setting for the column instead of the Link section. The HTML Expression that I have used is:
    &lt;a href="#" onclick="javascript:doDrilldown('#EMPNO#',this);"&gt;#EMPNO#&lt;/a&gt;And, in the page's HTML Header setting, I have added in:
    &lt;script type="text/javascript"&gt;
    function doDrilldown(empno,group)
    var g;
    var p = group.parentNode;
    while (p.tagName != "TR")
      p = p.parentNode;
    var x = p.getElementsByTagName("SELECT");
    if (x.length &gt; 0)
      g = x[0].value;
    var url = "f?p=&APP_ID.:183:&SESSION.::::P183_EMPNO,P183_GROUP:" + empno + "," + g;
    document.location.href = url;
    &lt;/script&gt;When a link is clicked, the doDrilldown function is called passing in the EMPNO value and the "this" object (which identifies the object triggering the call). The function starts from that object and goes up in the HTML tag tree to the nearest TR tag (the row tag that the link is on) and then finds the first SELECT list item on the row and gets its value. It then constructs a URL using this and the EMPNO value and performs a redirect to the second page (page 183 in this example).
    Andy

  • Adding weblogic server to eclipse

    I have installed weblogic 10.3.5 in my machine. I have checked out my project and now trying to add this to the app server. I went to server folder, right clicked
    Server - > Select Server under wizard - > select server -> next -> i see a list of servers.
    When i click oracle under the New Server my oracle weblogic is not listed. I can just see Oracle OC4J Standalone Server 10.1.3 and 10.1.3n. What should i do so my server is listed and i select them?

    Legacy OC4J plugins ship with Eclipse, but to work with WebLogic Server, you need to install Oracle plugins or start with one of the pre-assembled Eclipse distros that you can find on OEPE download site. Given your current setup, perhaps the easiest way to get WebLogic Server Tools is to follow the "download additional server adapters" link in the "New Server Runtime Environment" wizard.
    - Konstantin

  • EJB Service and Eclipse Link marshalling error.

    Hi all. I have a problem with using EJB Service in BPEL.
    I have two JPA entities linked with @OneToMany association
    // RegistryItemBuffer
    @Entity
    @NamedQueries( { @NamedQuery(name =
    "RegistryItemBuffer.findRegItemsBufByRegId",
    query =
    "select o from RegistryItemBuffer o where o.registry.registryId = :registryId") })
    @Table(name = "PP_PERSON_ST_RG_ITEM_B")
    public class RegistryItemBuffer implements Serializable {
    private Long registryItemId;
    private Registry registry;
    private static final long serialVersionUID = 7526471155622776147L;
    public RegistryItemBuffer() {
    *@ManyToOne*
    *@JoinColumn(name = "PP_PERSON_ST_RG_ID")*
    *public Registry getRegistry() {*
    return registry;
    *public void setRegistry(Registry registry) {*
    this.registry = registry;
    //Registry
    @Entity
    @Table(name = "PP_PERSON_ST_RG")
    public class Registry implements Serializable {
    private Long registryId;
    private Set<RegistryItemBuffer> registryItemBufferSet;
    private static final long serialVersionUID = 7526471155622776100L;
    public Registry() {
    *@OneToMany(mappedBy = "registry", fetch = FetchType.EAGER)*
    *public Set<RegistryItemBuffer> getRegistryItemBufferSet() {*
    return registryItemBufferSet;
    *public void setRegistryItemBufferSet(Set<RegistryItemBuffer> registryItemBufferSet) {*
    this.registryItemBufferSet = registryItemBufferSet;
    In my stateless session bean I have a method which fetches registry items by registry id using named query:
    @SuppressWarnings("unchecked")
    public List<RegistryItemBuffer> getRegistryItems(Long registryId) {
    Query query =
    em.createNamedQuery("RegistryItemBuffer.findRegItemsBufByRegId");
    query.setParameter("registryId", registryId);
    List<RegistryItemBuffer> items = query.getResultList();
    return items;
    If I call this method from EJB Client it works fine.
    In my composite application I've add EJB Service. I have add a jar with EJB Remote Interface to SCA-INF/lib and specified JNDI path and remote interface in EJB Service Reference.
    When I invoking getRegistryItems method from BPEL it fetches all items by the EclipseLink Exception throws at the end:
    javax.xml.bind.MarshalException
    - with linked exception:
    [Exception [EclipseLink-7242] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.Val
    idationException
    Exception Description: An attempt was made to traverse a relationship using indirection that had a null Session. This often
    occurs when an entity with an uninstantiated LAZY relationship is serialized and that lazy relationship is traversed after
    serialization. To avoid this issue, instantiate the LAZY relationship prior to serialization.]
    at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:375)
    at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:401)
    Why EclipseLink cannot serialize fetched registry items ?
    I would be grateful to any advice.
    P.S. Sorry, If there is more appropriate forum.

    Any clues to this one?

  • How can you SELECT via Database Link CLOB data using Application Express?

    Customer Issue:
    Developer using Oracle's Application Express 3.1. The Developer is trying to SELECT a CLOB datatype column from a remote (10.2.0.3) database, via a database link on her 10.2.0.4 based client Application. The Developer wants to be able to select CLOB data from the remote database which has limitation that she can't make any changes to the remote database.
    Developer's Comments:
    I do a select and get the error. Getting error ORA-22992: cannot use LOB locators selected from remote tables. So she feels she can't use dbms_lob.substr in this configuration I can do a "select into" but that is for one value. I am trying to run a select statement for a report that brings back more than one row. I do not have permission to change anything on the remote database. I want to access the remote database and multiple tables.
    This is not something I work with, would greatly appreciate help or ideas. Is this a limitation of the 3.1; or does she just not have this set up correctly; or should she be using a Collection (if yes, please share example)
    Thanks very much,
    Pam
    Edited by: pmoutrie on Jun 4, 2009 12:01 PM
    Hello???
    Would really appreciate an answer.
    Thanks,
    Pam

    This may not be a perfect solution for you but it worked for my situation.
    I wanted to grab some data from Grid Control's MGMT$JOB_STEP_HISTORY table but I couldnt' create an Interactive Report due to the existance of a CLOB column. I cheated this by creating a view on the GC DB, grabbing the first 4000 characters and turning it into a varchar2 column:
    create view test_job_step_history as
    select job_Name, target_name, status, start_time, end_time, to_char(substr(output,1,4000)) output
    from MGMT$JOB_STEP_HISTORY where trunc(end_time) > trunc(sysdate)-90
    In an APEX Interactive Report:
    select * from test_job_step_history@GCDB
    Granted, the output looks aweful right now but I am only looking for a very particular output (failed, denied, ORA-, RMAN-, etc) so the formatting isn't the most important thing to me right now.
    If anyone can improve -- and I'm sure you can -- on this I'd love to hear about it.
    Thanks,
    Rich

  • How to find out selected AssignedStory or Link?

    Hello to all,
    can anyone pls. explain how to find out which assigned story or link is selected at the time the script is fired.
    My problem is this: I would like to place an image into selected rectangle which is exported into .icml. So, for example, you have few exported rectangles and you would like to place an image into the one which is selected (through link or assignment panel). Because you can not select a rectangle in InCopy like you can in InDesign I tried to take a look through assigned stories...
                       For aCounter As Integer = 1 To myDocument.Assignments.Count
                            Dim myAssignment As InCopy.Assignment = myDocument.Assignments.Item(aCounter)
                            For sCounter As Integer = 1 To myAssignment.AssignedStories.Count
                                Dim myAssignedStory As InCopy.AssignedStory = myAssignment.AssignedStories.Item(sCounter)
                                Dim myStoryRef As Object = myAssignedStory.StoryReference
                                find out if assigned story or story reference is selected
                                'Rectangle
                                If TypeName(myStoryRef) = "Rectangle" Then
                                    Dim myObjectRectangle As InCopy.Rectangle = myStoryRef
                                    If myObjectRectangle.Graphics.Count = 0 And myObjectRectangle.Images.Count = 0 Then
                                        'CheckOut if needed
                                        'Place Media
                                    End If
                                End If
                            Next
                        Next
    Kind regards,
    Marko

    Well,
    I couldn't solve this without using a placeholder image. I found that you need to check if the selection is an image and than replace that image... So something like this below:
                    'Check if there is a selected image for relink
                    If myDocument.Selection.Count = 1 Then
                        If TypeName(myDocument.Selection.Item(1)) = "Image" Then
                            myImage = myDocument.Selection.Item(1)
                            myImageLink = myImage.ItemLink
                            Dim msgRet As MsgBoxResult = MsgBox("Would you like to relink selected image?", MsgBoxStyle.YesNoCancel, "Relink seleceted image?")
                            If msgRet = MsgBoxResult.Yes Then
                                        ' DO some action
                                        Dim MediaLink As String = something...
                                                'CheckOut action
                                                If myCheckOutMenu.AssociatedMenuAction.Enabled() Then
                                                    myCheckOutMenu.AssociatedMenuAction.Invoke()
                                                End If
                                                myImageLink.Relink(fileLink)
                                                Try
                                                    myImageLink.Update()
                                                Catch
                                                End Try
    Hope this helps.
    Regards,
    Marko

  • Text selection problem in linked containers

    Hi,
    I get a strange behavior on the selection of text in a textFlow with several linked containers (from the latest SVN version it seems).
    The problem occurs on the following case: http://lafabrick.com/labz/tlfTest/ (source code enabled)
    If I select some text in container D to A (or vice versa): display of text selection is correct.
    The problems are:
    - If I select some text in the containers B or C, and that I move the selection to the right or left: the container is moving ...
    - If I select some text in the containers B or C, and that I move the selection to the up or down: the display of the selection is not normal (I have a "blinking selection")
    TLF version : 502 (715519)
    Regards
    fabien

    Hi Richard,
    Would you like to said that this fixe is not present on the SVN (/trunk) ?
    In this case it's of course a bad news for me: my app can't takes all benefits of TLF for now (and for MAX...).
    But a good news for all ! It means that TLF is perhaps soon to release !
    Thanks a lot.
    Fabien

  • Execute a DML process after user selects a column link in a report

    APEX 3.2 / RDBMS 10GR2
    I have written a non IRR report that displays several rows of data. The first column of each row has a defined column link uniquely identifying the row. When a user selects one of the rows via the column link, a "hi fidelity" report is generated for that displayed row using a (RTF) report layout created in the shared components section of APEX.
    This is working well but I also need to execute a DML process after the user selects a row but prior to displaying the hi fidelity report using the selected column link value of the displayed row.
    As a URL is used to call hi fidelity report via the column link, it does not appear that the process section of the APEX page component is available to execute the DML prior to displaying the report.
    Any ideas on where to define the DML process?
    Thanks in advance.
    Barry D

    Hi Barry,
    Not knowing exactly what your URL calls, this is what I do for PL/SQL procedures that create HTML output:
    Create a blank page with no template and call the procedure inside a PL/SQL region with no template.
    Alternatively, if your URL opens in a new window:
    run some javascript for your link and pass a unique request through.
    The javascript needs to find the ApEx form, update it's target attribute and submit it with the unique request, then set the target back to blank.
    The form will submit into a new window.
    You can then have a process and branch allocated to this unique request to do what you want.
    Hope this helps
    Regards
    Michael

  • Adding a New Contact Record link in a report

    Dear Gurus,
    I've followed instructions on how to create a New record link in a report using instructions from the Oracle CRM On Demand Reporting book but needed additional help in terms of how to auto populate the Account Name onto the New Contact Edit screen. I've created a custom Contact report that is setup as a web applet to replace the OOB Contact section that is showing on the Account Detail screen.
    On this report, I've created a hyperlink that opens a New record edit screen for a Contact record. I need to pass in the Account Name since this is a required field on the Contact Detail screen and needed help with the URL that I've entered as a custom text format in the column formula. From the M. Lairson's Reporting book, I've entered:
    @[html]*a href="/OnDemand/user/ContactDetail?OMTGT=ContactDetailForm &ContactDetailForm.Id="@target="_
    top">"Contact Details"*/a*
    (html not displayed correctly - I've to substitute < and > with *)
    This worked great but I need to pass in the Account Name. Can you help with a URL that will do what I needed? Thanks.
    Edited by: TTone on Jul 26, 2010 12:16 AM
    Edited by: TTone on Jul 26, 2010 12:27 AM

    Hi,
    Copy the URL from the contact create link and pass the values like Account Name etc by adding it to the URL, use & to separate the values.
    hope it helps,
    Mayank

  • Can't select images to link them

    Hi,
    Hope you're well.
    I'm building a website where the menu items on the nav bar are images.
    When I try to link to select them in Dreamweaver to link them to other pages,
    they are not selectable.
    Assistance resolving this would be greatly appreciated. Here's a link to the domain:
    http://www.misteratm.com
    Thanks!

    In addition to the above posts, absolute positioning every div on the page is kind of like layering a web page. They all sit one on top of the other unless you specify otherwise with z-index. Therefore, the divs further down the code, will be the divs at the top of the layer stack. You are better to use other methods such as floats to position your design.
    Also, having a 100% image based website is a really bad idea and not necessary - especially without the use of ALT tags. You could try the below as a starter layout where I have changed your menu and content section into HTML.
    Rik
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Mister ATM - Home</title>
    <style type="text/css">
    /* Zero margins */
    body, .container, .header, #navigation, #navigation ul, #navigation ul li, .content, .right_col {
              margin:0;
              padding:0;
    body {
              background-color:#FFF;
              font:13px/17px normal "Times New Roman", Times, serif;
              color:#000;
    p {
              padding-bottom:10px;
              margin:0;
    .container {
              width:747px;
              height:auto;
              margin:30px auto 0 auto;
              overflow:auto;
    .header {
              background:#FFF url(http://www.misteratm.com/images/header.jpg) no-repeat;
              width:747px;
              height:84px;
              margin-bottom:30px;
    #navigation {
              background-color:#ddd;
              width:150px;
              min-height:100%;
              float:left;
    #navigation ul {
              width:150px;
              font:12px/16px bold Arial, Helvetica, sans-serif;
              color:#000;
              list-style-type:none;
              padding:10px 0;
    #navigation ul li {
              width:150px;
              height:30px;
              text-align:left;
    #navigation ul li a {
              color:#000;
              text-decoration:none;
              line-height:30px;
              padding-left:30px;
    #navigation ul li a:hover {
              color:#000;
              text-decoration:underline;
    .content {
              float:left;
              width:387px;
              padding:0 25px;
    .right_col {
              float:left;
              width:160px;
    #footer {
              width:100%;
              text-align:center;
              float:left;
              margin-top:30px;
              padding:10px 0;
              border-top:3px solid #03C;
    </style>
    </head>
    <body>
    <div class="container">
      <div class="header"></div>
      <div id="navigation">
        <ul>
          <li><a href="#">HOME</a></li>
          <li><a href="#">SERVICES</a></li>
          <li><a href="#">OUR MACHINES</a></li>
          <li><a href="#">ABOUT</a></li>
          <li><a href="#">CONTACT</a></li>
        </ul>
      </div>
      <div class="content"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consectetur nunc eu dolor dictum ut iaculis libero blandit. Aliquam egestas vehicula justo, sit amet feugiat nibh fringilla vitae. Praesent condimentum nibh a lectus semper venenatis. Cras in eleifend elit. Duis posuere, erat eget egestas gravida, arcu urna cursus dui, eget accumsan lorem ante non dolor. Etiam ornare sem a velit ultrices eget fringilla dui mollis. Sed risus nisi, feugiat vitae tristique vel, sodales suscipit augue. Sed lacinia auctor vestibulum. Nam id ligula ligula, pulvinar rhoncus ligula. In augue metus, placerat eu sodales non, pharetra suscipit erat. Duis ac est elit, vitae bibendum lectus. Suspendisse quis rutrum nisl. Duis iaculis iaculis interdum. Integer auctor elit vel libero porttitor tempus. Morbi in erat purus, id elementum est. </div>
      <div class="right_col">
                <img src="http://www.misteratm.com/images/mr_atm_home_sketch3__09.jpg">
      </div>
      <div id="footer">
        <p>This is where your footer goes</p>
      </div>
    </div><!-- End Container -->
    </body>
    </html>

Maybe you are looking for