Report 6i Sorting

Hi All,
I have the following query and I need to SORT on ALPHANUMEIC field SEGMENT1 field, it works fine in TOAD but when I run it in Oracle REPORTS, it does not SORTING Done, I have four groups in my report. How to sort based on Segment1 which is in 4th group.
SELECT
WDJ.CREATION_DATE ,
WE.WIP_ENTITY_NAME Job
,WE.DESCRIPTION Job_Desc
,ML1.MEANING Status
,msi.segment1 ASSY
,WDJ.PRIMARY_ITEM_ID Assembly_ID
,MSI.DESCRIPTION Assembly_Desc
,MSI.PLANNER_CODE Planner
,WDJ.SCHEDULED_START_DATE Scheduled_Start
,WDJ.CLASS_CODE Class
,WDJ.BOM_REVISION
,WRO.QUANTITY_PER_ASSEMBLY
,WRO.SUPPLY_SUBINVENTORY
,WAC.DESCRIPTION Class_Desc
,WDJ.START_QUANTITY Job_Start_Qty
,WDJ.SCHEDULED_COMPLETION_DATE Scheduled_Complete
,DECODE(WRO.WIP_SUPPLY_TYPE,2,2,3,2,WRO.WIP_SUPPLY_TYPE)
Supply_Code
,ML2.MEANING Wip_Supply_Type
,WRO.DATE_REQUIRED Date_Required
,msi2.inventory_item_id component_item_id
,msi2.segment1 Component
,MSI2.DESCRIPTION Comp_Desc
,decode(MSI2.SERIAL_NUMBER_CONTROL_CODE,1,null,'Y') SERIALIZED
,WRO.OPERATION_SEQ_NUM Op_Seq
,SUM(WRO.REQUIRED_QUANTITY - WRO.QUANTITY_ISSUED) Quantity_Open
, SUM( DECODE (
(WRO.REQUIRED_QUANTITY - WRO.QUANTITY_ISSUED),
0,
NULL,
DECODE (
SIGN (WRO.REQUIRED_QUANTITY),
-1 * SIGN (WRO.QUANTITY_ISSUED),
(WRO.REQUIRED_QUANTITY - WRO.QUANTITY_ISSUED),
DECODE (
SIGN(ABS (WRO.REQUIRED_QUANTITY)
- ABS (WRO.QUANTITY_ISSUED)),
-1,
NULL,
(WRO.REQUIRED_QUANTITY - WRO.QUANTITY_ISSUED)
QTY_OPEN
,MSI2.PRIMARY_UOM_CODE UOM
,NVL(MOQ2.QUANTITY,0) Quantity_On_Hand
,WDJ.BUILD_SEQUENCE Build_Sequence
,SG.SCHEDULE_GROUP_NAME Schedule_Group_Name
FROM MFG_LOOKUPS ML1
, MFG_LOOKUPS ML2
, MTL_ITEM_LOCATIONS MIL
, MTL_ITEM_LOCATIONS MIL2
, MTL_SECONDARY_INVENTORIES MSINV
, MTL_ITEM_QUANTITIES_VIEW MOQ2
, WIP_ENTITIES WE
, MTL_SYSTEM_ITEMS MSI
, WIP_ACCOUNTING_CLASSES WAC
, MTL_SYSTEM_ITEMS MSI2
, WIP_REQUIREMENT_OPERATIONS WRO
, WIP_SCHEDULE_GROUPS SG
, WIP_DISCRETE_JOBS WDJ
WHERE WDJ.ORGANIZATION_ID = 1147
--&P_STATUS_WHERE
--AND    WDJ.STATUS_TYPE IN (3,4)
AND SG.SCHEDULE_GROUP_ID (+) = WDJ.SCHEDULE_GROUP_ID
AND SG.ORGANIZATION_ID (+)= WDJ.ORGANIZATION_ID
AND ML1.LOOKUP_TYPE = 'WIP_JOB_STATUS'
AND ML1.LOOKUP_CODE = WDJ.STATUS_TYPE
AND ML1.ENABLED_FLAG = 'Y'
AND MSI.INVENTORY_ITEM_ID(+) = WDJ.PRIMARY_ITEM_ID
AND MSI.ORGANIZATION_ID(+) = 1147
AND WE.WIP_ENTITY_ID = WDJ.WIP_ENTITY_ID
AND WE.ENTITY_TYPE = 1
AND WE.ORGANIZATION_ID = 1147
--&P_PRINTED
--&P_ENTITY_WHERE
AND WE.WIP_ENTITY_NAME= 470202
--&C_Limit_Jobs
--&C_Limit_Dates
--&C_Schedule_Group
AND WAC.CLASS_CODE = WDJ.CLASS_CODE
AND WAC.ORGANIZATION_ID = 1147
AND WRO.WIP_ENTITY_ID = WDJ.WIP_ENTITY_ID
AND WRO.ORGANIZATION_ID = 1147
AND WRO.WIP_SUPPLY_TYPE <> 6
AND ( ( WRO.REQUIRED_QUANTITY > 0
AND WRO.REQUIRED_QUANTITY - WRO.QUANTITY_ISSUED > 0 )
OR ( WRO.REQUIRED_QUANTITY < 0
AND WRO.REQUIRED_QUANTITY - WRO.QUANTITY_ISSUED < 0 ) )
--&C_Limit_Supply_Type
--&C_Limit_Subinv
AND ML2.LOOKUP_TYPE = 'WIP_SUPPLY_PICK'
AND ML2.LOOKUP_CODE = DECODE(WRO.WIP_SUPPLY_TYPE,2,2,3,2,WRO.WIP_SUPPLY_TYPE)
AND ML2.ENABLED_FLAG = 'Y'
AND MIL.INVENTORY_LOCATION_ID(+) = WRO.SUPPLY_LOCATOR_ID
AND MIL.ORGANIZATION_ID(+) = 1147
AND MSI2.INVENTORY_ITEM_ID = WRO.INVENTORY_ITEM_ID
AND MSI2.ORGANIZATION_ID = WRO.ORGANIZATION_ID
AND MOQ2.ORGANIZATION_ID(+) = 1147
AND MOQ2.INVENTORY_ITEM_ID(+) = WRO.INVENTORY_ITEM_ID
AND MSINV.ORGANIZATION_ID(+) =1147
AND MSINV.SECONDARY_INVENTORY_NAME(+) = MOQ2.SUBINVENTORY_CODE
AND (MSINV.DISABLE_DATE IS NULL OR
MSINV.DISABLE_DATE > TRUNC(SYSDATE))
AND nvl(MSINV.AVAILABILITY_TYPE,2) = 1
AND MIL2.INVENTORY_LOCATION_ID(+) = MOQ2.LOCATOR_ID
AND MIL2.ORGANIZATION_ID(+) = 1147
AND nvl(MOQ2.SUBINVENTORY_CODE,'XX') in ('FG','SFG', 'RM')
GROUP BY
WDJ.CREATION_DATE ,
WE.WIP_ENTITY_NAME
,WE.DESCRIPTION
,ML1.MEANING
,msi.segment1
,WDJ.PRIMARY_ITEM_ID
,MSI.DESCRIPTION
,MSI.PLANNER_CODE
,WDJ.SCHEDULED_START_DATE
,WDJ.CLASS_CODE
,WDJ.BOM_REVISION
,WRO.QUANTITY_PER_ASSEMBLY
,WRO.SUPPLY_SUBINVENTORY
,WAC.DESCRIPTION
,WDJ.START_QUANTITY
,WDJ.SCHEDULED_COMPLETION_DATE
,DECODE(WRO.WIP_SUPPLY_TYPE,2,2,3,2,WRO.WIP_SUPPLY_TYPE)
,ML2.MEANING
,WRO.DATE_REQUIRED
,WRO.OPERATION_SEQ_NUM
,WRO.SUPPLY_SUBINVENTORY
,MSI2.PRIMARY_UOM_CODE
,msi2.inventory_item_id
,msi2.segment1
,MSI2.DESCRIPTION
,decode(MSI2.SERIAL_NUMBER_CONTROL_CODE,1,null,'Y')
,NVL(MOQ2.QUANTITY,0)
,WDJ.BUILD_SEQUENCE
,SG.SCHEDULE_GROUP_NAME
ORDER BY msi2.segment1

Wow, what a query.
Tried a Tabular report successfully with ...
SELECT deptno, mgr, job, empno, ename, sal
FROM EMP
GROUP BY deptno, mgr, job, empno, ename, sal
ORDER BY sal
So the report should work if your query works, unless you are mingle with Reports' group reports which chooses its own break fields.

Similar Messages

  • Print or download ALV report with sort options

    Dear friends,
    How i can download into excel or print ALV report with sort options, like customer name column with similar values should not repeat in the print out or download file.
    Regards,
    Praveen Lobo

    Hi Praveen,
    Use this code, its working:-
    *FOR SORTING DATA
    DATA : it_sort TYPE slis_t_sortinfo_alv,
           wa_sort TYPE slis_sortinfo_alv.
    *          SORT W.R.T. CUSTOMER NAME
      wa_sort-spos = 1.
      wa_sort-fieldname = 'NAME1'. "field customer name
      wa_sort-tabname = 'IT_KNA1'. "internal table with records
      wa_sort-up = 'X'.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
    "this will sort the ALV o/p for customer with same name
    "now the name will not be repeated
    "records with same name will be grouped
    *          DISPLAY RECORDS IN ALV GRID
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program                = sy-repid "report id
        it_fieldcat                       = it_field "field catalog
        it_sort                           = it_sort "sort info
      TABLES
        t_outtab                          = it_kna1 "internal table
      EXCEPTIONS
        program_error                     = 1
        OTHERS                            = 2.
      IF sy-subrc <> 0.
      ENDIF.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir
    Edited by: Tarun Gambhir on Dec 31, 2008 1:13 PM

  • Report not initially sorted as defined by Report Attributes "Sort Sequence"

    I have a Report Region with Type SQL Query and Source "SELECT * FROM <table>" where <table> has a primary key from a sequence. Under Report Attributes, I have Report Column "ST_NM" with Show and Sort checked and having a Sort Sequence of "1". I assume this is to set the iniital display sequence but regardless, the report rows display in Primary key order initially.
    To try it: http://apex.oracle.com/pls/apex/f?p=21997:2 with Dever/Ima9Dever
    1) How do I set the initial display sequence to be other than the primary key sequence?
    [Note: It seems to work part (or all?) of the time under our 4.1 implementation.]
    Thanks,
    Howard
    I thought this one would be easy!

    Howard (DBA in Training) wrote:
    I have a Report Region with Type SQL Query and Source "SELECT * FROM <table>" where <table> has a primary key from a sequence. Under Report Attributes, I have Report Column "ST_NM" with Show and Sort checked and having a Sort Sequence of "1". I assume this is to set the iniital display sequence but regardless, the report rows display in Primary key order initially.
    To try it: http://apex.oracle.com/pls/apex/f?p=21997:2 with Dever/Ima9Dever
    1) How do I set the initial display sequence to be other than the primary key sequence?
    [Note: It seems to work part (or all?) of the time under our 4.1 implementation.]Standard reports store sort columns persistently across sessions as user preferences. It's likely that Dever user has at some point clicked to sort on the PK column and created a persistent preference. Try it with a new user that has never viewed the page before...
    See +{thread:id=2433320}+ for more on this, including how to reset it.

  • Classic report column sorting

    Hello to APEX forum
    My Apex version is 4.2.1,
    database version is Oracle 10g XE on Windows 7 Pro
    After upgrading from version 3.2 to 4.2.1 report column sorting doesn't work when "Enable Partial Page Refresh" is set to "Yes".
    When "Enable Partial Page Refresh" is "No" sorting is OK.
    Please, help
    Regards
    Mark

    Hi Mark,
    it looks like your json.js causes troubles. It extends every JavaScript "object" with two methods called toJSONString and parseJSON. I did a quick debugging and it looks like when we construct our AJAX request to do the sorting, the jQuery AJAX handling tries to serialize those two function because it thinks it's regular data and fails with a JavaScript error.
    Looking at the original source of your library at https://github.com/douglascrockford/JSON-js even the creators had some doubts using that version of the library
    json.js: This file does everything that json2.js does. It also adds a toJSONString method and a parseJSON method to Object.prototype. Use of this file is not recommended.
    Are you sure that you need the parseJSON and toJSONString methods? Maybe you are fine with json2.js as well.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Report column sort not working

    Hello,
    Apex 4.1
    I have a master-detail report and form. I have ticked the "Sort" box in the Report Attibutes to sort by one of the fields, a text field. However, when I click on the column heading to sort the report it sorts by the primary key id column instead.
    Is there something else that needs to be done to enable a sort on a column?
    Kind regards,
    Simon

    Hi,
    Login to APEX builder. Run your page.
    Select columns from report action menu and save default layout.
    Regards,
    Jari

  • Question on Interactive Report feature sorting

    Hi,
    I have about over 10,000 records and used the interactive report feature on Apex. For some reason, on the timestamp column, I tried to resort in the latest date and it only shows the latest date of last year and didn't show the latest date of 2010. I tried changing the timestamp column to sort by descending, and it doesn't show any latest date in 2010, only 2009.
    Could this be an issue with the interactive report issue.
    Thanks,
    Michael

    Hi,
    If you have default 10,000 row limit in interactive report , sorting work only for that record set.
    Increase rows that report show, or you can use ORDER BY in report select to get e.g. 10,000 latest row.
    Br,Jari

  • Report formatting/sorting issue

    Hi,
    Here is something I spent a whole day on, and still can't figure out.
    I have a simple SQL report, which is supposed to show estimated and actual expenses and the variance between the two. The trick is that whenever the variance is positive, the numbers should be green and whenever it is negative - the numbers should be red and NO MINUS SIGN should be shown. For example, if the variance is "-15", then a red "15" should be shown.
    The report query is as follows:
    SELECT
    region,
    estimate,
    actual,
    (estimate - actual) AS variance,
    (CASE
    WHEN (estimate - actual)>=0 THEN 'green'
    WHEN (estimate - actual)<0 THEN 'red'
    ELSE NULL
    END) AS variance_color
    FROM
    expenses
    And then the following HTML expression is used for the Column Formatting on "variance" field (sorry for double "<<" and extra spaces - I could not figure out how to format text for this posting):
    << span style = " color : #VARIANCE_COLOR# ; font-weight : bold ; ">#VARIANCE#<< / span>
    All works quite well and I get the colors right, but I still have the minus sign on the negative numbers. If I use "ABS(estimate - actual) AS variance" in my query, I certainly can get rid of it, but then sorting does not work properly, since negative numbers are treated as positive.
    Any ideas would be appreciated.
    Constantine

    Hello Constantine,
    >> If I use "ABS(estimate - actual) AS variance" in my query, I certainly can get rid of it, but then sorting does not work properly, since negative numbers are treated as positive
    Please try the following:
    SELECT
    region,
    estimate,
    actual,
    '<input type="hidden" value="'||(estimate-actual)||'">'||
    abs(estimate - actual) AS variance,
    (CASE
    WHEN (estimate - actual)>=0 THEN 'green'
    WHEN (estimate - actual)<0 THEN 'red'
    ELSE NULL
    END) AS variance_color
    FROM expensesThe trick is to add to the column a hidden prefix with the real value of the column, and then concatenate it with the visible value. As the sort order is determine by the beginning of the column – the hidden prefix in our case – you can enjoy both worlds – maintain a correct sorting order while displaying only positive colored numbers.
    >> sorry for double "<<" and extra spaces - I could not figure out how to format text for this posting)
    You should use the forum tags *&#91;code]* and *&#91;/code]* .
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Forthcoming book about APEX: Oracle Application Express 3.2 – The Essentials and More

  • How to exclude one or more rows of SQL report from sorting?

    In my SQL report I want to exclude one row from sorting. This row must be permanently at the bottom of the report.
    How to achieve this?
    Regards,
    Al

    Hi Al,
    Check out this thread: Sort within Break? I was looking to preserve a basic sort for break purposes, but the same solution should work for keeping one row at the bottom.
    Let me know if you'd like more details.
    --Jennifer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Report Column Sorting problem

    I have a report based on a view. For some reason some of the columns are not being sorted correctly. After pressing the column header to sort date columns the underlying data is not sorted properly (it’s out of order) or it’s not sorted at all.
    Can you please let me know if there is a known bug causing that?

    I think I'm having the same problem.
    I have a report with data columns, several "not shown" columns, and several column links. I've noticed that any columns in the query after a certain point, will not sort the correct column. If I show all the columns and allow them all to sort, then some of the columns will sort the data in another column. (for example clicking on the header/sort link for column x sorts the table by column y and clicking on the sort link for column z sorts column x, etc).
    I've noticed that I can move columns around in my select query and no matter how they are arranged, after the 7th or 8th column in the select statement, none of the columns following that will sort properly. I've tried all kinds of things, changing my select query around, enabling and disabling sorting, adding additional null columns in, setting and unsetting the default sort order, changing the order of the columns in the report. I don't have an order by in my query or anything weird besides some where clauses (most of which are from the default search functionality).
    Has anyone found a solution to this problem? We just upgraded from HTML DB 2.2 to APEX 3.0 and the problem remained the same.
    Thanks,
    Greg

  • ORA-06502 on  'SQL query' report with sort in 'Report Attributes'

    Hi All,
    We get the next error if we set sorting on a column in a 'Report' based on a 'SQL query'. Removing the sort, error disappeares:
    failed to parse SQL query:
    ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    Any suggestions?
    Erik

    Erik,
    Thanks, this explains it. By specifying the request as part of your URL you run into the recently uncovered issue. The request you're setting is REMFROMLIST and ADD2LIST. You probably either have links that include those requests or you have branches where you specify them. Either way, in order to get reports sorting to work, you'll have to make sure that the request strings are not part of your URL. This is a work-around and the upcoming HTML DB patch release will solve this issue.
    One way of avoiding this is to have computations on the previous pages that set a napplication level or page level item to the REMFROMLIST and ADD2LIST values and then you can use those items for your conditions that are currently evaluating those strings.
    Hope this helps and sorry for the inconvenience,
    Marc

  • Crystal reports graph sort order

    I have 2 fields called fiscal year and fiscal month.
    Expected sort order - sample values:
    Fiscal year     Fiscal Month
    2011     5
    2011     5
    2011     6
    2011     7
    2011     8
    2011     9
    2011     10
    2011     11
    2011     12
    2012     1
    2012     2
    2012     3
    2012     4
    2012     5
    2012     5
    Current sort order- shows up incorrectly by default
    Fiscal Year  Fiscal Month
    2011          10
    2011          5
    2011          6
    2012         12
    I will be using these values in a graph and I created a new formula column called time PEriod that I will be in the
    x axis of my graph (mid({query.fiscal_mth_nbr1},1,3)) . the output of this formula is Oct,Nov, Dec,Jan,....Oct
    Without the year, but it still needs to be sorted in the first sample values order , since fiscal year starts in Jun and ends
    in July. We are now in fiscal year 2012 , fiscal month 6
    I tried sorting the value inside crystal reports by going to design view and applying sort. But it does not take the
    sort order. Can you please suggest the best way to keep the sort order. The data is coming from a universe and I even tried
    to sort the data from the universe by using order by, but the database would not let me use order by  that in a derived table within the universe.
    Edited by: developerbo1 on Nov 14, 2011 7:19 PM

    hello,
    the best way to get the correct dynamic sort is by using a two digit month in your conversion. for example
    totext({table.datefield}, 'yyyyMM')

  • Merging Different Reports and Sort by Groups

    Hi everyone,
    I am merging two different reports by using the "sub-report" function, but wanted to know if I can sort the primary report and the sub report by groups once they are merged?
    For example, the Primary report and the sub report share the same group names, in this case, company names.  However each report represent different data, one for sales performance of all the sales person within the company, and another are sales accounts maintained by the company.
    Ideally, I'd like to see the primary and sub report display the sales account data and sales performance data in one place so I can print them out in packages sorted by company names.   Currently, I am having to print out both reports separately and compiling the printouts manually (Very Tedious!).
    Thank You in advance!
    Frank

    Hi,
      In the case you can try linking main report with sub report using the group field. Right Click on sub report > change sub report link > select the field from main report and link  it to the sub report group field.
    Regards,
    Vinay

  • Field should not display in the subtotal row in ALV report after sorting .

    we have a requirement, after sorting and subtotaling, the output in ALV is -
    vbeln        amount1  amount2  amount3
    123           11              12            13
    123           12             13             14
    123           23             25             27 
    133           11              12            13
    133           12             13             14
    133           23             25             27
    Now the customer wants the ALV outpput in this fashion -
    123           11              12            13
    123           12             13             14
                     23             25             27    --->123 (vbeln) should not come in subtotaling row
    133           11              12            13
    133           12             13             14
                      23             25             27--->133(vbeln) should not come in subtotaling row

    Hi,
    if it helps you could create a hierachy. In this way you can define the field catalog for the lines and for the subtotal columns. The only thing is that you would always show the subtotal rows.
    You have references of hierachy alvs in
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f
    ALV Hierarchy
    alv hierarchy
    In this case it also sorts
    Sorting for ALV hierarchy
    I hope it helps.
    Edited by: Oscar Pecharroman on Aug 2, 2010 1:13 PM

  • Report column sorting

    Hi All,
    I have a oracle report which extracts the output in csv format. I have to add to new columns in the exisiting report. After adding the new column, those columns are not apperaing as kept in the repeating frame. The new columns comes first in csv file and then the rest of the columns. I need that columns to be inserted in 5th and 6 th position.
    Please tell me is how to do this.
    Thanks in advance,
    Jeeva.

    Hi Ammad,
    I am using oracle reports 10g. Thanks for you reply ..... My problem has been resolved. The excel output is genereated based on the order of the column in the first group data model .. After changing those columns i can able to see the output in the specified manner.
    Thanks again for you time :)
    Jeeva.

  • APEX_ITEM report - SORT doesn't work

    Hi,
    For the following report, the SORT doesn't work. I've also tried with the "Report Attributes", but same result. Does someone know is there a way to make it sorted or can confirm it's not possible.
    Thanks.
    SELECT
    APEX_ITEM.CHECKBOX(11,id_cc_delai_recueil) id_cc_delai_recueil,
    APEX_ITEM.HIDDEN(12,id_cc_delai_recueil)||APEX_ITEM.HIDDEN(13,id_cc_regle)||APEX_ITEM.TEXT(14,numdelai,3) numdelai,
    APEX_ITEM.SELECT_LIST_FROM_LOV(15,typedoss,'DOSSIERS OU DOCUMENTS',NULL,'NO') typedoss,
    APEX_ITEM.TEXT(16,suppdoss,3) suppdoss,
    APEX_ITEM.SELECT_LIST_FROM_LOV(17,rem_suppdoss,'REMARQUE_DELAI',NULL,'YES','','') rem_suppdoss,
    APEX_ITEM.TEXT(18,perioactif,3) perioactif,
    APEX_ITEM.SELECT_LIST_FROM_LOV(19,rem_perioactif,'REMARQUE_DELAI',NULL,'YES','','') rem_perioactif,
    APEX_ITEM.TEXT(20,periosmact,3) periosmact,
    APEX_ITEM.SELECT_LIST_FROM_LOV(21,rem_periosmact,'REMARQUE_DELAI',NULL,'YES','','') rem_periosmact,
    APEX_ITEM.SELECT_LIST_FROM_LOV(22,dispoinact,'DISPOSITION1',NULL,'NO') dispoinact,
    APEX_ITEM.SELECT_LIST_FROM_LOV(23,rem_dispoinact,'REMARQUE_DELAI',NULL,'YES','','') rem_dispoinact
    FROM
    cc_delai_recueil
    WHERE id_cc_regle = :P52_ID_CC_REGLE
    ORDER BY
    3,
    2

    Paulo,
    Remove the Order By clause from your Select statement and then use the Report Attributes to determine your sort order.
    Jeff

Maybe you are looking for