Query builder 'order by'

Hi all,
I'm using query builder to retrieve result. Generated query statement is:
     /jcr:root/content/dam/myFolder//element(*, dam:Asset) order by jcr:content/metadata/general/@views descending
The attribute 'views' is of xtype numberfield, but of course numberfield is a textfield with only numbers allowed inside and stored as String.
Ordering by this attribute returns hits ordered in descending alphabetical order.
My question is if it's possible to execute query with ordering by number value of it's attribute, not string value.
Thanks a lot for help

The xpath search cannot do this. So the best option (also in terms of performance) is to make that property a LONG.
Alternatively you can write a custom querybuilder predicate evaluator that can provide a custom comparator. In the query, you would then address that predicate in the orderby to use the comparator:
stringasnumber=jcr:content/metadata/general/views
orderby=stringasnumber
It could inherit from the standard JcrPropertyPredicateEvaluator or even from RangePropertyPredicateEvaluator (to support range queries as well, using filtering). Note that such a comparator will be slow if there are many results to order (since it does not make use of any search index).

Similar Messages

  • Query Builder - sort order causing ORA-00979 error

    Hello,
    I'm having an issue with the "sort order" clause in the query builder tool when using a function on the same column.
    I've build a simple query in the gui and the following statement is displayed in the SQL Window
    select     "DEMO_ORDER_ITEMS"."ORDER_ID" as "ORDER_ID",
         sum(DEMO_ORDER_ITEMS.QUANTITY) as "QUANTITY"
    from     "DEMO_ORDER_ITEMS" "DEMO_ORDER_ITEMS"
    group by DEMO_ORDER_ITEMS.ORDER_ID
    and if I add a sort order of "1" on the quantity field, the following query is changed to
    select     "DEMO_ORDER_ITEMS"."ORDER_ID" as "ORDER_ID",
         sum(DEMO_ORDER_ITEMS.QUANTITY) as "QUANTITY"
    from     "DEMO_ORDER_ITEMS" "DEMO_ORDER_ITEMS"
    group by DEMO_ORDER_ITEMS.ORDER_ID
    order by DEMO_ORDER_ITEMS.QUANTITY DESC
    When running this query I get an error
    failed to parse SQL query:
    ORA-00979: not a GROUP BY expression
    It is quite obvious what is wrong with the query but I don't know how to get the query builder tool to generate the correct statement. The order by clause should be order by sum(DEMO_ORDER_ITEMS.QUANTITY) DESC.
    I've tried to do some searching and haven't found much documentation on this issue. Any assistance is appreciated.
    Thanks,
    Tony

    While this statement is generally certainly true and should also be remembered, it is not really helpful for the specific case.
    I think the behaviour described is a bug. However this might be one a little difficult to solve. The user unfortunatly can't influence much of the query builder results directly.
    Either put 1 into the order by clause or use the column alias name without table alias name ("QUANTITY" only).
    My personal solution would be NOT TO use any sort criteia in the query builder. This makes sense in so far as the generated SQL is often basis for some report. If that is an interactive report you won't add a sort order anyway. This is a layout thing and layout will be handled by the end user itself. he can choose whatever sorting he wants.
    Edited by: Sven W. on Jul 22, 2009 11:43 AM

  • How to change the font in query builder window in Reports 6i?

    Hi
    I am facing the old problem again and again, which is I can not find any way to change the font in query builder window in Reports 6i. The current font is so bad for alignment and ordering each part of SELECT statement. Is there any way to change this to COURIER NEW for example?

    No, but I suggest using a different editor which does allow a different text option and just pasting it in.

  • Vs 2010 Query Builder

    Hi guys,
    i'm using oracle 11.2.0.3 32 bit with vs2010 sp1.
    I'm developing a windows application and i create a dataset file in order to map my db on it.
    I want to add a custom select to a table adapter a i notice a problem.
    My query is: SELECT simulatori.SEQ1.nextval FROM dual
    simulatori is an oracle db and seq1 is a sequence.
    If seq1 has a public synonym the query works, instead, if i want to specified the user also Query Builder quotes the simulatori user and the query doesn't work.
    Why?
    Edited by: user6231851 on 5-dic-2012 11.26

    user6231851 wrote:
    Hi guys,
    i'm using oracle 11.2.0.3 32 bit with vs2010 sp1.
    I'm developing a windows application and i create a dataset file in order to map my db on it.
    I want to add a custom select to a table adapter a i notice a problem.
    My query is: SELECT simulatori.SEQ1.nextval FROM dual
    simulatori is an oracle db and seq1 is a sequence.
    If seq1 has a public synonym the query works, instead, if i want to specified the user also Query Builder quotes the simulatori user and the query doesn't work.
    Why?
    Edited by: user6231851 on 5-dic-2012 11.26What's the error you are getting?
    Not sure what you mean by "quotes the simulatori user". If you mean that it adds quotations in the query, then make sure that you are providing all upper case, eg "SIMULATORI". Otherwise, the quotes may trigger case sensitivity. That's just a guess. I will need more information.

  • Query Builder functionality

    Has anyone built a Query Builder Page in the apps that is similar to the standard APEX Query Builder?

    I haven't done exactly this, but remember doing a tabular form genarator (similar to the tabular form wizard in the builder) choosing tables, columns and field types. But that was using Apex 3.2, now that we have jQuery and dynamic actions in Apex 4.0, it should be much easier.
    If you looking for an approach, here's one
    <li>create a left side bar region with tables from schema: report or list based
    select table_name from user_tables<li>On click of the list entry, show a modal dialog of a report based on the columns of the selected table
    SELECT * FROM USER_TAB_COLS WHERE table_name = :<TABLE_NAME ITEM> Show images based on column type ("data_type" in user_tab_cols)
    Checkboxes return the column name for each row
    <li> Have a dynamic action that runs for each checkbox calling a PLSQL to update a collection adding the clicked column name to the the list.
    Refresh a updateable report region which is based on the collection , showing the column, sort order,group by options
    and JS code to move rows up or down (
    move_up code (pseudo code)
    this_row = $(this.triggeringElement).parents('tr:first);
    prev_row = this_row.prev();
    next_row = this_row.next();
    //move up
    prev_row.before(this_row);Then the SQL code generation would concatenate the application arrays containing the column names adding columns one row at a time and adding sort and order options. You would need to some custom PLSQL coding, looping throw each row adding predicates.

  • Query Builder in Business Object Edge 3.1

    Greeting,
    When I was using Crystal Vision Server 11.5, I can use the Query Builder to get metadata for objects stored in the repository. Now we moved to BO XI Edge 3.1 with WACS. I click on the click for Query Build and the system said the link is broken. I read SAP note "1206301 - How to access the query builder in XI 3.x ", but it is only for Java / Apache server.
    Please help.
    Thanks.

    Hi Leo,
    It is my understanding that Query Builder, QAAWS and Live Office are Java based, and therefore only work with Tomcat and not WACS. Unless something has changed, you will have to uninstall and reinstall BO with Tomcat in order to use those tools.
    Thanks

  • Query Builder recognizing primary/foreign key

    Is there a way to have Query Builder recogninze the primary/foreign keys of the tables when they are selected? Right now it looks like you have to manually join the tables together by selected the column(s) to join.
    Thanks

    You can define a query key[1] 'planId' on InvestmentOption for the PLAN_OID column. That'll let you write an expression like the one below which does not produce a join. The nice part about the query key is that it does not require you to add attributes to your object in order to query o them.
    Expression plan = new ExpressionBuilder();
    Expression where = plan.get("planId").equal(somePlanId);--Shaun
    [1] http://www.oracle.com/technology/products/ias/toplink/doc/10131/main/_html/descfg010.htm#sthref3039

  • Query builder bug in outer joins ?

    I understood that if you were joining two tables A and B, the following was a
    LEFT OUTER JOIN
    SELECT A.COL, B.COL
    FROM A, B
    WHERE A.ID = B.ID (+)
    ie: a LEFT outer join has the (+) on the Right-hand table.
    However, query builder puts the (+) on the Left-hand table.
    Same for a RIGHT outer join - I think the (+) should be on the Left-hand table, but query builder puts it on the Right-hand table.
    Cheers,
    Andrew
    (running Version 2.1.0.00.39)

    Hi Andrew,
    I just played a little with the query builder and created a join between two of my tables:
    PROJECTS and ACTIVITIES, linked via KCC.
    When I create a left outer join in query builder, I get the following result:
    select     "PROJECTS"."KCC" as "KCC"
    from     "ACTIVITIES" "ACTIVITIES",
         "PROJECTS" "PROJECTS"
    where "PROJECTS"."KCC"(+) ="ACTIVITIES"."KCC"
    Which is correct: Left refers to the first table in the from clause (ACTIVITIES) and places the (+) on the other table!
    Left and right refers to the order of tables in the from clause, not in the where clause. Query builder sorts the tables in FROM alphabetically, maybe this is differing from the graphical order in query builder.
    Regards
    Alex

  • Query Builder dynamicly change the request

    Hello,
    I use VS2010 with ODT 11.2.0.1.1 and I have strange behaviour with the "Query Builder"...
    When I enter this request:
    SELECT ARTICLE_PCH.AP_CODE ....ARTICLE_SAP.AS_USAGE_UNIQUE
    FROM ARTICLE_SAP, ARTICLE_PCH
    WHERE ARTICLE_SAP.AS_NUMERO = ARTICLE_PCH.AS_NUMERO ( + ) AND (ARTICLE_SAP.AS_CIRCUIT = 'SAD') AND (ARTICLE_SAP.AS_SUPRESSION IS NULL) AND
    (ARTICLE_SAP.AS_FAMILLE 'ZEPS') AND (ARTICLE_PCH.AP_CODE IS NULL)
    ORDER BY ARTICLE_SAP.AS_LIB_40
    The query builder add a ( + ) before the "IS NULL"
    Like This
    SELECT ARTICLE_PCH.AP_CODE ....ARTICLE_SAP.AS_USAGE_UNIQUE
    FROM ARTICLE_SAP, ARTICLE_PCH
    WHERE ARTICLE_SAP.AS_NUMERO = ARTICLE_PCH.AS_NUMERO ( + ) AND (ARTICLE_SAP.AS_CIRCUIT = 'SAD') AND (ARTICLE_SAP.AS_SUPRESSION IS NULL) AND
    (ARTICLE_SAP.AS_FAMILLE 'ZEPS') AND (ARTICLE_PCH.AP_CODE ( + ) IS NULL)
    ORDER BY ARTICLE_SAP.AS_LIB_40
    And then the request return a wrong result. When I test with sqlplus the request without the ( + ) return the good result. But I can't enter the request because the query builder automaticaly modify my request...
    Did someone have the same problem with this beta of ODT ?
    With the previous version of ODT I don't have the problem.
    Thanks in advance
    Jeff

    Hi Jeff,
    Our engineers are looking into this. Right now, it appears this change is being done by Query Builder itself (eg there may be nothing we can do to stop it). This did not happen in VS2008.
    However if you change your original query to the equivalent using the "LEFT OUTER JOIN" keywords, you can avoid this problem entirely:
    For example:
    From:
    SELECT EMP.ENAME, EMP.JOB, EMP.MGR, DEPT.DNAME, DEPT.LOC
    FROM EMP, DEPT
    WHERE EMP.DEPTNO = DEPT.DEPTNO (+) AND (DEPT.DNAME IS NULL)
    ORDER BY EMP.ENAME
    To:
    SELECT EMP.ENAME, EMP.JOB, EMP.MGR, DEPT.DNAME, DEPT.LOC
    FROM EMP LEFT OUTER JOIN
    DEPT ON EMP.DEPTNO = DEPT.DEPTNO
    WHERE (DEPT.DNAME IS NULL)
    ORDER BY EMP.ENAME
    Can you try this with your query? We will follow up with MS to find out if there is anything we can do to stop Querybuilder from changing the query in VS2010.
    Thanks,
    Christian

  • Query Builder on VS2010 change my request

    Hello,
    I use VS2010 with ODT 11.2.0.1.1 and I have strange behaviour with the "Query Builder"...
    When I enter this request:
    SELECT ARTICLE_PCH.AP_CODE ....ARTICLE_SAP.AS_USAGE_UNIQUE
    FROM ARTICLE_SAP, ARTICLE_PCH
    WHERE ARTICLE_SAP.AS_NUMERO = ARTICLE_PCH.AS_NUMERO (+) AND (ARTICLE_SAP.AS_CIRCUIT = 'SAD') AND (ARTICLE_SAP.AS_SUPRESSION IS NULL) AND
    (ARTICLE_SAP.AS_FAMILLE <> 'ZEPS') AND (ARTICLE_PCH.AP_CODE IS NULL)
    ORDER BY ARTICLE_SAP.AS_LIB_40
    The query builder add a (+) before the "IS NULL"
    Like This
    SELECT ARTICLE_PCH.AP_CODE ....ARTICLE_SAP.AS_USAGE_UNIQUE
    FROM ARTICLE_SAP, ARTICLE_PCH
    WHERE ARTICLE_SAP.AS_NUMERO = ARTICLE_PCH.AS_NUMERO (+) AND (ARTICLE_SAP.AS_CIRCUIT = 'SAD') AND (ARTICLE_SAP.AS_SUPRESSION IS NULL) AND
    (ARTICLE_SAP.AS_FAMILLE <> 'ZEPS') AND (ARTICLE_PCH.AP_CODE (+) IS NULL)
    ORDER BY ARTICLE_SAP.AS_LIB_40
    And then the request return a wrong result. When I test with sqlplus the request without the (+) return the good result. But I can't enter the request because the query builder automaticaly modify my request...
    Did someone have the same problem with this beta of ODT ?
    With the previous version of ODT I don't have the problem.
    Thanks in advance
    Jeff

    Hi Jeff,
    Please post this on the ODT discussion forum:
    Oracle Developer Tools for Visual Studio
    Regards,
    -Naveen

  • Need ABAP Query Builder Like Ms-SQLQuery Builder for Critical ABAP-Query

    Dear ABAP Friends,
    I Need ABAP Query Builder which is as flexible as Ms-SQLQuery Builder for building Critical ABAP-Queries e.g. "I have 4 master tables , Each master table having self-join with some condition and these 4 Result-Sets have Innser-Join+Left Outer Join " Please Help.

    I have seen TCODE SQ01, But I found that this TCODE may be used to build simple ABAP Query with Selection-screen which can be used for generating simple report. But i think for critical query ??????????
    I have build my Query in MS-SQL and got the right output, Now how do I write this in ABAP Using Join statement. Please Help.....................
    My SQL Query as below(Remember this is a single Query and verified correct in SQL):
    SELECT     P1.PERNR, P1.ENAME, P1.BEGDA AS P1BEGDA, P1.ENDDA AS P1ENDDA, P1.AEDTM AS P1AEDTM, P1.UNAME AS P1UNAME, P1.PERSG, P1.PERSK,
                          P1.PLANS,
           P2.ENDDA AS P2ENDDA, P2.BEGDA AS P2BEGDA, P2.AEDTM AS P2AEDTM, P2.UNAME AS P2UNAME, P2.GESCH, P2.FAMST,
                       P21.ENDDA AS P21ENDDA, P21.BEGDA AS P21BEDDA, P21.AEDTM AS P21AEDTM, P21.UNAME AS P21UNAME, P21.FAMSA, P21.FAVOR, P21.FANAM,
                          P21.FGBDT, P21.FASEX,
                       P0.ENDDA AS P0ENDDA, P0.BEGDA AS P0BEDDA, P0.AEDTM AS P0AEDTM, P0.UNAME AS P0UNAME, P0.MASSN,
                          P0.MASSG
    FROM         (SELECT     TOP (100) PERCENT PA0001_2.PERNR, PA0001_2.ENDDA, PA0001_2.BEGDA, PA0001_2.AEDTM, PA0001_2.UNAME, PA0001_2.PERSG,
                                                  PA0001_2.PERSK, PA0001_2.PLANS, PA0001_2.ENAME
                           FROM          PA0001 AS PA0001_2 INNER JOIN
                                                      (SELECT     PERNR, MAX(ENDDA) AS ENDDA
                                                        FROM          PA0001 AS PA0001_1
                                                        GROUP BY PERNR) AS Pi1
    ON PA0001_2.PERNR = Pi1.PERNR
    AND PA0001_2.ENDDA = Pi1.ENDDA
                                               ORDER BY PA0001_2.PERNR) AS P1 LEFT OUTER JOIN
                              (SELECT     TOP (100) PERCENT PA0000.PERNR, PA0000.ENDDA, PA0000.BEGDA, PA0000.AEDTM, PA0000.UNAME, PA0000.MASSN,
                                                       PA0000.MASSG
                                FROM          PA0000 INNER JOIN
                                                           (SELECT     PERNR, MAX(AEDTM) AS Pi0AEDTM
                                                             FROM          PA0000 AS PA0000_1
                                                             GROUP BY PERNR) AS Pi0 ON PA0000.PERNR = Pi0.PERNR AND PA0000.AEDTM = Pi0.Pi0AEDTM
                                ORDER BY PA0000.PERNR) AS P0 ON P1.PERNR = P0.PERNR LEFT OUTER JOIN
                              (SELECT     TOP (100) PERCENT PA0021.PERNR, PA0021.ENDDA, PA0021.BEGDA, PA0021.AEDTM, PA0021.UNAME, PA0021.FAMSA, PA0021.FAVOR,
                                                       PA0021.FANAM, PA0021.FGBDT, PA0021.FASEX
                                FROM          PA0021 INNER JOIN
                                                           (SELECT     PERNR, MAX(AEDTM) AS Pi21AEDTM
                                                             FROM          PA0021 AS PA0021_1
                                                             GROUP BY PERNR) AS Pi21 ON PA0021.PERNR = Pi21.PERNR AND PA0021.AEDTM = Pi21.Pi21AEDTM
                                ORDER BY PA0021.PERNR) AS P21 ON P1.PERNR = P21.PERNR LEFT OUTER JOIN
                              (SELECT     TOP (100) PERCENT PA0002.PERNR, PA0002.ENDDA, PA0002.BEGDA, PA0002.AEDTM, PA0002.UNAME, PA0002.GESCH,
                                                       PA0002.FAMST
                                FROM          PA0002 INNER JOIN
                                                           (SELECT     PERNR, MAX(ENDDA) AS Pi2ENDDA
                                                             FROM          PA0002 AS PA0002_1
                                                             GROUP BY PERNR) AS Pi2 ON PA0002.PERNR = Pi2.PERNR AND PA0002.ENDDA = Pi2.Pi2ENDDA
                                ORDER BY PA0002.PERNR) AS P2 ON P1.PERNR = P2.PERNR
    xxxxx----
    Edited by: Goutam Roy on May 5, 2009 1:11 PM

  • Oracle UCM Query Builder

    Does anyone know if is there a way to export the results of a saved query to a CSV or some other file that could be opened in excel. I can view the information I need in the query builder window but I have a need to export it to CSV for manipulation in Excel. I have tried copying the data out of UCM but the formatting gets messed up in the copying.
    Thanks
    Data_bitz

    Thank u for your reply and I did find enterprise manager. My problem is now I need to specify Management Server in order to log on to Enterprise Manager. I tried putting my computer name but that didn't work. How would I determine my Management Server??

  • Query Builder - 2 occurrences of same table and Show Related Tables

    In SQL Developer 1.5 the Query Builder still does not allow you to drag two copies of the same table onto the canvas. Additionally the Show Related Tables does not appear to do anything even after Hide Related Tables. Both of these operations sets the cursor to the hourglass although you can continue working as if the commands completed OK. Query Builder is a great time saver but with limitations like this it is really hobbled.
    Additionally, in order to get join conditions you have to double-click the join in the diagram before the appropriate WHERE clause appears. I have not found any reference to how to use the Query Builder in any documentation. This forum has stated that the Query Builder is supposed to be intuitive and easy to use but this is not the case so far.
    The rest of SQL Developer is a pleasure to use!

    Thanks for your feedback. There are a number of things we want to do to the Query Builder. The issue about dragging 2 copies of a table onto the work surface is a logged enhancement request that we want to address. The Show Related tables and hourglass issues are bugs and need to be addressed. I'll document those.
    Better documentation is also important and we can add that into the product for a future release.
    In the short term, I have on previous occasion said I'd do a demo for using the Query Builder, so I'll make that a priority.
    Sue

  • Eclipse - RDS Query Builder dies young

    I'm running Eclipse 3.4.2 on Vista (please keep any
    anti-Vista bigotry to yourself, unless you are aware of any known
    Vista-related issues that are related to this one). I've installed
    the Adobe CF801 Extensions in order to do debugging and data
    acccess. I'm also running Cold Fusion 8 - single server with IIS.
    DB is Oracle 10g - also installed locally on the same machine.
    I created my RDS Configuration on Port 80 with RDS
    authentication, etc. No Problem - both "Test Connection" and "Test
    Debugger" are successful.
    Now I go into the RDS Query Builder and things are looking
    pretty happy. I can see the database objects, maybe select a table
    or two...even build and run queries. But after running like one
    query (or maybe only browsing a couple of tables) I get this
    message: "A connection to the RDS Server could not be established
    because the webserver was unreachable".
    So, I close out the Query Builder and bring the RDS
    Configuration back up - re-try the "Test Connection" and "Test
    Debugger" and they both still work. When I bring the Query Builder
    back up, I get the same "connection...could not be established"
    message and the Query Builder screen is just all blank.
    Consistently, when I then Exit Eclpse, I get a popup saying:
    "Exception EOSError in module RDSQueryBuilder.dll at 000113E5.
    System Error. Code 1404. Invalid Hook Handle."
    Did the same thing over several times with the same result.
    Also, rebooted the whole box and things still work the same.
    Seemingly the QueryBuilder is losing its handle on the RDS
    Configuraion or possibly not releasing some kind of lock on it
    between queries or schema gets, even though my connections are
    still fine.
    This definitely isn't going to cut it - if I have to exit and
    re-start Ecipse everytimh I need to do a query.
    Any suggestions?

    in addition, I can say that I installed the same flex builder
    trial on an XP machine, using its own local RDS, and found that the
    wizard worked just fine.
    So what is the variable here, why is the wizard not working
    on the vista PC ?
    Is it Vista ?
    Is it the fact that I'm trying to use RDS against a remote
    server and not the local one ?

  • Query Builder - Path and Object name for instance ..

    Hello,
    how to get the Object Name of an Instance "InstanceX" and the Path of the Object with query Builder ..
    Thanks

    Hi Leo,
    It is my understanding that Query Builder, QAAWS and Live Office are Java based, and therefore only work with Tomcat and not WACS. Unless something has changed, you will have to uninstall and reinstall BO with Tomcat in order to use those tools.
    Thanks

Maybe you are looking for

  • Conversion of character field to currency format

    Hi All I am reading an excel file witch has a netwr amount fiels as character type ,  but when I try to update the field table netwr which is CURR data type the program dumps sayin it can not do that becuase of the format . is there any way of conver

  • Invalid file reference in iPhoto

    Has anyone lese had a problem with the new iphoto? I downloaded the update at the weekend (9.1.2 (605)) and the last batch of movies and photos that I had imported from my iPhone have all gone wrong If I double click on a previous photo, the disappea

  • SQL SERVER Upgrade using different Language Media

    Hi I have a doubt. OS is Windows 2003 Server ( Japanese Version ) SAP - ERP6.0 SR3 ( EN + JA Installed) My customer is having SQL Server 2000. ( Japanese Version ). While upgrading the SQL Server to 2005, can we use a English Version Media to upgrade

  • How can i validate(compare) two date type attribute in EO.

    Hi All, jdev version 11.1.2.1.0 i have created one EO where two date type attribute ToDate and FromDate now i want to add validation rule. which validate that difference b/w ToDate and FromDate not more than 3 month. How can i validate this?

  • I have imported IE9 bookmarks but do not know where to access them in firefox

    I have installed Firefox 7 and have all the toolbars on screen but I cannot access the bookmarks that I imported from Internet Explorer 9. When I click Bookmarks on the top left of the page (on te menu that says File, Edit, View, History, Bookmarks,