Order by a function column

Hi,
Is it possible to sort a report based not just on databse columns but on function and summary columns in Reports?
tnx
Ivan

Puedes hacer lo sigte.:
En el SQL QUERY STAMENT
select empno, ename, sal, :net_sal -->(function name)
from emp
order by 4 asc/desc

Similar Messages

  • The order of the table columns to Srini Chavali

    OK I made a mistake Srini Chavali.
    So why dont you try to help me now beyond just warn me about burocratic issues, what you really should had done instead just to block the answers of my former question ?
    The question is:
    How to influence the order of the table columns in time of transformation logic to relational ?
    Nelson Alberti da Rosa

    because exist an order among primary key columns that was definied in the logical model and it he can't see that.fixed :
    function addPKcolumns(list,table){
         pk = table.getPK();
         if(pk!=null){
              pcols = pk.getColumns();
              for(var i = 0;i<pcols.length;i++){
                   col = pcols;
                   //in fact don't need this check, because PK columns are processed first
                   if(!list.contains(col)){
                        list.add(col);
    function addFKcolumns(list,fkeys){
         for(var k=0;k<fkeys.length;k++){
              fcols = fkeys[k].getColumns();
              for(var i = 0;i<fcols.length;i++){
              col = fcols[i];
              if(!list.contains(col)){
                   list.add(col);
    //adds mandatory or oprional columns to list depending on mand parameter
    function addMandatoryOptColumns(list,cols, mand){
         for(var i = 0;i<cols.length;i++){
              col = cols[i];
              if(col.isMandatory() == mand && !list.contains(col)){
                   list.add(col);
    tables = model.getTableSet().toArray();
    list = new java.util.ArrayList();
    for (var t = 0; t<tables.length;t++){
         list.clear();
         table = tables[t];
         cols = table.getElements();
         // add PK columns to list
         addPKcolumns(list,table);
         // add FK columns to list
         addFKcolumns(list,table.getFKAssociations());
         //add mandatory columns
         addMandatoryOptColumns(list,cols,true);
         //add optional columns
         addMandatoryOptColumns(list,cols,false);
         //use list to reorder columns
         ord_cols = list.toArray();
         for(var n = 0;n<ord_cols.length;n++){
              table.moveToIndex(ord_cols[n],n);
         //prevent reordering from enginnering, can be changed with UI
         table.setAllowColumnReorder(false);
         table.setDirty(true);

  • Performance... Why a function column in a view is executed more than once...?

    Why a function column created inside a view is executed more than once when called more than once?
    EXAMPLE:
    create or replace view aux1 as
    date_column,
    any_function(date_column) column1
    from any_table
    create or replace view aux2 as
    column1 c1,
    column1 c2,
    column1 c3
    from aux1
    select * from aux2
    It will execute 3 times the function any_function... logically the value will be the same for all columns...
    I understand why!... are 3 calls... but...
    Why not to create a "small" verification and if the function column was execute replace the second, the third... value? ... instead of execute 3, 4... times...
    tks
    Braga

    Actually, this is more than a performance issue. This is a consistency problem. If the function is NOT deterministic then you may get different values for each call which is clearly not consistent with selecting 3 copies of the same column from a row. Oracle appears to have fixed this in 9i...
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.7.2.0 - Production
    With the Partitioning option
    JServer Release 8.1.7.2.0 - Production
    create view v1 as select dbms_random.value(1,100) r from dual;
    create view v2 as select r r1, r r2 from v1;
    select * from v2;
              R1           R2
              93           74
    Connected to:
    Oracle9i Enterprise Edition Release 9.0.1.3.0 - Production
    With the Partitioning option
    JServer Release 9.0.1.3.0 - Production
    create view v1 as select dbms_random.value(1,100) r from dual;
    create view v2 as select r r1, r r2 from v1;
    select * from v2;
              R1           R2
              78           78Richard

  • How to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx?

    Dear SharePoint Developers,
    Please help.
    I need to know How to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx?
    I think this is a "sealed column", whatever that is, which is  shown in SPD 2013 as a column of content type "document, folder, MyCustomContentType".
    I know when I set the column order in my custom Content Type settings page, it is correct.
    But, when I load the NewDocSet.aspx page, the column order that I set in the settings page is NOT used for this "sealed column" which is bad.
    Can you help?
    Please advise.
    Thanks.
    Mark Kamoski
    -- Mark Kamoski

    Hi,
    According to your post, my understanding is that you want to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx.
    Per my knowledge, if you have Content Type management enabled for the list or library (if you see a list of content type with the option to add more), the display order of columns is set for each content type.
    Drill down into one of them and you'll see the option under the list of columns for that content type.
    To apply the column order in the NewDocSet.aspx page, you need to:
    Select Site Settings, under Site Collection Administration, click Content type publishing. In the Refresh All Published
    Content Types section, choose Refresh all published content types on next
    update.
    Run two timer jobs(Content Type Hub, Content Type Subscriber) in central admin(Central Administration--> Monitoring--> Review timer jobs).
    More information:
    http://sharepoint.stackexchange.com/questions/95028/content-types-not-refreshing-on-sp-online
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • [svn] 4634: First part of glue code for allowing Halo components to use the new Text Layout Framework , in order to get functionality such as bidirectional text.

    Revision: 4634
    Author:   [email protected]
    Date:     2009-01-22 17:38:56 -0800 (Thu, 22 Jan 2009)
    Log Message:
    First part of glue code for allowing Halo components to use the new Text Layout Framework, in order to get functionality such as bidirectional text.
    Background:
    TLF is making this possible by implementing a TLFTextField class. It is a Sprite that uses TLF to implement the same properties and methods as the legacy TextField class in the Player. Thanks to the createInFontContext() bottleneck method in UIComponent, it can be used by a properly-written Halo component (such as those in Flex 3) without any modifications to the component.
    Note: Text should render similarly -- but is unlikely to render identically -- when a component uses TLFTextField vs. TextField. The width and height may be different, affecting layout; text could wrap differently; etc. This is a fact-of-life based on the fact that TLF/FTE and TextField are completely different text engines.
    Whether a Halo component uses TLF or not to render text will be determined in Flex 4 by a new style, textFieldClass. (Gumbo components always use TLF.)
    TLFTextField is currently only partially implemented. It does not yet support scrolling, selection, editing, multiple formats, or htmlText. Therefore it can only be used for simple display text, such as a Button label.
    Details:
    The TextStyles.as bucket 'o text styles now includes a non-inheriting textFieldClass style. It can be set to either mx.core.UITextField or mx.core.UITLFTextField. These are the Flex framework's wrapper classes around the lower-level classes flash.text.TextField (in the Player) and its TLF-based workalike, flashx.textLayout.controls.TLFTextField.
    The global selector in defaults.css currently sets it to mx.core.UITextField using a ClassReference directive. For the time being, all Halo components will continue to use the "real" TextField.
    The new UITLFTextField is a copy of UITextField, except that it extends TLFTextField instead of TextField. This class has been added to FrameworkClasses.as because no classes in framework.swc have a dependency on it. It will get soft-linked into applcations via the textFieldClass style.
    The TLFTextField class currently lives in a fourth TLF SWC, textLayout_textField.swc. This SWC has been added to various build scripts. The external-library-path for building framework.swc now includes all four TLF SWCs, because UITLFTextField can't be compiled and linked without them. However, since they are external they aren't linked into framework.swc.
    Properly-written Halo UIComponents access their text fields only through the IUITextField interface, and they create text fields like this:
    textField = IUITextField(createInFontContext(UITextField));
    (The reason for using createInFontContext() is to support embedded fonts that are embedded in a different SWF.)
    The createInFontContext() method of UIComponent has been modified to use the textFieldClass style to determine whether to create a UITextField or a UITLFTextField.
    With these changes, you can now write code like
    to get two Buttons, the first of which uses UITextField (because this is the value of textFieldClass in the global selector) and the second of which uses UITLFTextField. They look very similar, which is good!
    Currently, both Buttons are being measured by using an offscreen TextField. A subsequent checkin will make components rendering using UITLFTextField measure themselves using an offscreen TLFTextField so that measurement and rendering are consistent.
    QE Notes: None
    Doc Notes: None
    Bugs: None
    Reviewer: Deepa
    Modified Paths:
        flex/sdk/trunk/asdoc/build.xml
        flex/sdk/trunk/build.xml
        flex/sdk/trunk/frameworks/projects/framework/build.xml
        flex/sdk/trunk/frameworks/projects/framework/defaults.css
        flex/sdk/trunk/frameworks/projects/framework/src/FrameworkClasses.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/metadata/TextStyles.as
    Added Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UITLFTextField.as

    Many of your points are totally legitimate.
    This one, however, is not:
    …To put it another way, the design of the site seems to be geared much more towards its regular users than those the site is supposedly trying to "help"…
    The design and management of the forums for more than five years have driven literally dozens of the most valuable contributors and "regulars" away from the forums—permanently.
    The only conclusion a prudent, reasonable person can draw from this state of affairs is that Adobe consciously and deliberately want to kill these forums by attrition—without a the PR hit they would otherwise take if they suddenly just shut them down.

  • SQL function column in drop down list's data provider's query

    Just wondering, if it is somehow possible to use SQL function column for drop down list through data provider.
    At the moment, I am using id column as return value and name as display value from this query through CachedRowSetDataProvider:
    SELECT ALL someTable.Id,
    someTable.Name,
    someTable.Postal_Code,
    FROM someTable
    However, I want to change display to use calculated column as display value, for example Name_PostalCode from below mentioned changed query:
    SELECT ALL someTable.Id,
    CONCAT(someTable.Name, ' - Pin Code: ',someTable.Postal_Code) Name_PostalCode ,
    someTable.Name,
    someTable.Postal_Code,
    FROM someTable
    But JSC doesn't seem to like this.
    Is it someway possible to achieve this?
    Thanks.

    >
    But JSC doesn't seem to like this. Can you explain more. When doesn't it like it, in the design view, in the query editor, when your run it? What is the error you are seeing?
    See http://blogs.sun.com/divas/entry/displaying_multiple_fields_in_a

  • Why order by clause maintains column number values instead of column names

    why order by clause maintains column number values instead of column names ?

    we can use oder by 1,2 as column number
    UGNo one said that it can't be used. What's your point?
    To OP: It can be written with the column's 'select list positional number' just because for the support of laziness. :)
    There's no difference between 'ORDER BY name, address' and 'ORDER BY 1,2'.

  • SRM 7.0: Purchase Order Response (BUS2209) functionality, workflow

    Hello,
    We're trying to configure the purchase order response (BUS2209) functionality. We have configured the BUS2209 document types and numberranges and maintained the 'purchase order response expected' marker for certain vendors. We therefore expected to be able to post a POR via the Purchasing:PO powl however the 'create POR manually' and other 'POR actions' are greyed out. Has anybody been able to post BUS2209 documents in an SRM 7.0 system?
    Also if we look at: IMG -> SAP SRM -> SRM SERVER -> Cross-Application Basic Settings -> Business Workflow -> Define Process Levels  -
    No BUS2209 object is list, no workflow can be maintained (you can't add anything manually either). We have activated the Process Controlled Workflow for all business objects.
    Any help and input is very much appreciated.
    Kind regards,
    Tim

    Hi Tim,
    I did two things:
    1) I activated the start conditions for the three POR workflows as supplied by SAP. I still think this has nothing to do with the problem, but you never know.. The setting is located in the IMG under Workflow -> Application-controlled wfl, or similar (I don't have access to the system right now).
    2) I created a tolerance group Zxxx with tolerance key PR; I used 'limit as percentage' of 5% in both upper and lower limit.  I assigned the key Zxxx to the attribute TOG of a user (with the role /SAPSRM/OP_PURCHASER)  in PPOMA_BBP.
    This caused the options to be enabled. I then successfully created a PO response manually for a PO, which in turn caused a change version of the PO to be created. This change version had to be approved in order for the changes in the POR to be valid.
    Regards
    t7

  • I lost the ability to order and hide site columns if i use custom content type with a custom Create Form

    I have a team site collection and I want to add a new App of type Issue Tracking list. so I did the following:-
    From the site collection I created a new App of type issue tracking.
    Then from the site collection I created a new Content type named “CustomIssue” which has its parent as “Issue” content type.
    I went to the Issue tracking list and I changed the default content type from Issue , to the new “CustomeIssue” content type.
    I open the site collection using SP designer and I created a new Create form for my Issue tracking list based on the "CustomIssue" content type and I select to have the Create form as the default form when creating an item.
    Everything till this point worked well. But when I open the “customIssue” content type , and I re-order the columns and I hide some columns, this was not reflected inside the custom Create form …
    although when using the default content type and the default create form you can control the order of the fields and to specify if certain fields hold be hidden inside the Create form.. so can anyone advice on this please?

    Hi,
    According to your post, my understanding is that you lost the ability to order and hide site columns if i use custom content type with a custom Create Form.
    I try to reproduce the issue, the result is the same as yours.
    As a workaround, if I modify the custom content type form the site setting, and then change the NewForm as the default form, it will change the column orders.
    However, if I use the new created form as the default form, it will remain the original orders.
    I recommend that you modify the custom content type form the site setting, and then reset the NewForm as the default form.
    The result is as below:
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support
    ok thanks for the explanation ,, but what if i want to change the order and hidde some fields in the future ,, do i have to chnage the defualt create form again ...

  • Understanding sum() over(order by) analytic function

    Could you please explain Having_order_by column values computation for below query?
    I understand that No_Partition column has been computed over entire result set
    select level
    ,sum(level) over(order by level) Having_order_by
    ,sum(level) over() No_Partition
    from dual
    connect by level < 6

    Hi,
    ActiveSomeTimes wrote:
    Could you please explain Having_order_by column values computation for below query?
    I understand that No_Partition column has been computed over entire result set
    select level
    ,sum(level) over(order by level) Having_order_by
    ,sum(level) over() No_Partition
    from dual
    connect by level < 6
    When you have an ORDER BY clause, the function only operates on a window, that is, a subset of the result set, relative to the current row.
    When you say "ORDER BY LEVEL", it will only operate on LEVELs less that or equal to the current LEVEL, so on
    LEVEL = 1, the analytic fucntion will only look at LEVEL <= 1, that is, just 1; on
    LEVEL = 2, the analytic fucntion will only look at LEVEL <= 2, that is, 1 and 2; on
    LEVEL = 3, the analytic fucntion will only look at LEVEL <= 3, that is, 1, 2 and 3
    LEVEL = 6, the analytic fucntion will only look at LEVEL <= 6, that is, 1, 2, 3, 4, 5 and 6
    In the function call without the ORDER BY clause, the function looks at the entire result set, regrdless of what vlaue LEVEL has on the current row.

  • Do you know the link between the sales order item and functional location ?

    How know the functional location if I know de sales order number and item ?
    Wich table or bapi ?
    Tks.

    Hi,
    I think there's all details in my question.
    You answer is right only if I need to know the functional location at AUFNR level.
    Is not my case, I need this information at sales order level.
    Regards,
    Roberto.

  • Open Order Quantity - SOP "0" column

    Dear Grurs/Friends
    In the SOP Flexible Planning for my scenario, one of the Key figure is Open Order Quanity.
    This is std sap field
    I want to maintain this automatially from the system in "0" column during the every month opening
    ie) for the month columns are June08, July08,Aug08
    the "0" column should have the open order qty at the end of May08
    I read the Library, i need more clarity of Mapping the same
    Prabakaran K

    closed

  • ORDER BY ON INDEX COLUMN IS TAKING MORE TIME

    Hi,
    The following SQL query when executed with ORDER BY is taking 3 mins. If we remove ORDER BY it is taking 32 secs. We have an index on ID which is used in ORDER BY clause. Can any one tell us what could be wrong? My assumption is ORDER BY on an index column should not take that much of time. Is there any configuration that we need to make or missing?
    We are on 11g R2.
    Query is
    SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum  FROM
    (SELECT DISTINCT ENTITYID AS a1, ENTITYCLASS AS a2, STARTDATE AS a3, ENDDATE AS a4, EXTERNALOBJECTID AS a5, LASTMODIFIEDUSER AS a6, ID AS a7, PARTITION AS a8,    DESCRIPTION AS a9, NAME AS a10, PERMISSIONS AS a11, CREATEDDATE AS a12, ACTIVITY AS a13, ENTITYVERSION AS a14, EXTERNALNAME AS a15, NOSPEC AS a16,
    ADMINSTATE AS a17, OWNER AS a18, LASTMODIFIEDDATE AS a19, EXTERNALARRANGEMENT AS a20, OBJECTSTATE AS a21, EXTERNALMANAGEMENTDOMAIN AS a22,
    CREATEDUSER AS a23, SPECIFICATION AS a24 FROM Service WHERE (ENTITYCLASS = 'SERVICEDAO') ORDER BY ID ASC)
    a WHERE ROWNUM <= 25) WHERE rnum > 0Here is the explain plan link
    https://stbeehive.oracle.com/content/dav/st/Rama%20%20Public%20Workspace/Public%20Documents/explainplan_13339959.JPG
    https://stbeehive.oracle.com/content/dav/st/Rama%20%20Public%20Workspace/Public%20Documents/explainplandetailed_13339959.JPG
    Thanks,
    Rama
    Edited by: user9954330 on Nov 8, 2011 1:16 AM

    user9954330 wrote:
    We replaced the hint with ALL_ROWS. With this change , we observed the query performed worse. Any other pointers? I will provide the other details as given in the template shortly.
    Thanks,
    RamaThread: HOW TO: Post a SQL statement tuning request - template posting
    HOW TO: Post a SQL statement tuning request - template posting

  • How can I order PL/SQL functions in "Called" a "Caller" order in function script file

    Does anybody know how to create PL/SQL function script file
    in "called" and "caller" (parent/child) order.
    Thanks
    Soheil

    Does anybody know how to create PL/SQL function script file
    in "called" and "caller" (parent/child) order.
    Thanks
    Soheil

  • GROUP BY: determinstic function column of group by expression 10g vs 11g

    The following works in 10g but now fails in 11g.
    Simple description: If I create a view of a number and subtract 2 from that number
    and I group by the first column and include the 2nd column, it works in 10g and gives "not a group by column" in 11g.
    It seems that 10g knew the 2nd column was derived by the first column so grouping by the 1st column gave an automatic pass to the 2nd column.
    11g seems to be more strict (though I don't know why, if the 2nd column's function is purely deterministic as you would expect subtracting by 2 would be. Same is true for UPPER())
    Is there a reason for this change in behaviour in 11g?
    Is there some explicit reason for the change in functionality?
    Exact versions and results below
    Line: -----
    Connected to:
    Oracle Database 10g Release 10.2.0.3.0 - Production
    SQL> drop view v1;
    View dropped.
    SQL> drop view v2;
    View dropped.
    SQL>
    SQL> create view v1 as
    2 select '0' c1, 0 c2 from dual
    3 union all
    4 select '1', 1 from dual
    5 union all
    6 select '2', 2 from dual
    7 union all
    8 select '3', 3 from dual;
    View created.
    SQL>
    SQL>
    SQL> create view v2
    2 as select c1, upper(c1) c1u, c2, c2-2 c3
    3 from v1;
    View created.
    SQL>
    SQL> select c1, c1u
    2 from v2
    3 group by c1;
    C C
    1 1
    3 3
    0 0
    2 2
    SQL>
    SQL> select c1, c2, c3
    2 from v2
    3 group by c1, c2;
    C C2 C3
    1 1 -1
    3 3 1
    2 2 0
    0 0 -2
    -- =============================================================================================
    Connected to:
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    SQL> drop view v1;
    View dropped.
    SQL> drop view v2;
    View dropped.
    SQL>
    SQL> create view v1 as
    2 select '0' c1, 0 c2 from dual
    3 union all
    4 select '1', 1 from dual
    5 union all
    6 select '2', 2 from dual
    7 union all
    8 select '3', 3 from dual;
    View created.
    SQL>
    SQL>
    SQL> create view v2
    2 as select c1, upper(c1) c1u, c2, c2-2 c3
    3 from v1;
    View created.
    SQL>
    SQL> select c1, c1u
    2 from v2
    3 group by c1;
    select c1, c1u
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression
    SQL>
    SQL> select c1, c2, c3
    2 from v2
    3 group by c1, c2;
    select c1, c2, c3
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression
    Edited by: joriotis on Jul 25, 2011 11:01 AM
    Edited by: joriotis on Jul 25, 2011 11:03 AM

    Hi,
    Just 4 hours ago, someone else had a very similar question:
    Group by fails on ORA-00979
    Personally, I consider that a bug in Oracle 10. When you do a GROUP BY on a view, you can't expect the SQL engine to look at the view definition, and determine if one of the columns can be derived from another.
    In practice, it's easy enough to add c1u to the GROUP BY clause, or to use MAX (c1u) instead of c1u, to make your query work.

Maybe you are looking for