Sorting with nulls last on the fact column

anybody tell me how to do the sorting with nulls last in the template? i can't change anything in data model or anywhere other than template.
i did try to put the descending order,but null values are coming in between positive and negative values.
<?sort:FACT_Column_Name;'decending';data-type='number'?>
could anyone please tell me how can i do that in template?
Thanks in advance.
Edited by: user12255470 on Apr 12, 2012 5:29 PM

Hi to all,
i've solved, is very simple using decode inside the select:
SELECT
ID,
FK_HTMLDB_ITEM, DECODE(FK_HTMLDB_ITEM,1,HTMLDB_ITEM.DATE_POPUP(3,rownum,VAL,'dd-mon-yyyy'),2,HTMLDB_ITEM.TEXT(3,VAL)) VALORE
FROM TESTID
my table is:
CREATE TABLE "DEV"."TESTID"
(     "ID" NUMBER NOT NULL ENABLE,
     "FK_HTMLDB_ITEM" NUMBER,
     "VAL" VARCHAR2(4000 BYTE))
Bye Bye

Similar Messages

  • REPORT WITH CHANGING ITEM ON THE SAME COLUMN

    Hi to all,
    i'm trying to build a report with different item in the same column.
    Is that possible in any way using other Oracle technique?
    i'm not doing anything specific here, only i would like to know if the following possibility exist or not and how can i let apex render the htmldb_item fields 'dynamically'.
    Using this CODE inside a PL/SQL function body returning sql query I obtain the following report content. Such the code of htmldb_item.fields is written, as a field value the HTML_ITEM is not rendered, so only the description of them appear in the report.
    Does somebody know some tricks to make it work?
    Thanx a lot
    1     2     LAST_CALL     htmldb_item.date_popup (4, ROWNUM, FLD_VALUE,'dd/mon/yyyy') VALUE
    21     1     AGE     htmldb_item.text(4,FLD_VALUE,10,10) VALUE
    create or replace FUNCTION FNC_GEN_GUI_ITEM(ITEM_TYPE NUMBER) RETURN VARCHAR2 AS
    STRHTMLDITEM VARCHAR2(4000);
    BEGIN
    CASE ITEM_TYPE
    WHEN 1 THEN STRHTMLDITEM:=' htmldb_item.text(4,FLD_VALUE,10,10) VALUE ';
    WHEN 2 THEN STRHTMLDITEM:=' htmldb_item.date_popup (4, ROWNUM, FLD_VALUE,''dd/mon/yyyy'') VALUE ';
    END CASE;
    RETURN STRHTMLDITEM;
    END FNC_GEN_GUI_ITEM;
    MY TABLE AS FOLLOWS:
    CREATE TABLE "NEWPROJ"."DINFIELDGUI"
    (     "ID" NUMBER NOT NULL ENABLE,
         "FLD_TYPE" NUMBER,
         "FLD_NAME" VARCHAR2(4000 BYTE),
         "FLD_VALUE" VARCHAR2(4000 BYTE),
         CONSTRAINT "DINFIELDGUI_PK" PRIMARY KEY ("ID"));
    Message was edited by:
    Marcello Nocito

    Hi to all,
    i've solved, is very simple using decode inside the select:
    SELECT
    ID,
    FK_HTMLDB_ITEM, DECODE(FK_HTMLDB_ITEM,1,HTMLDB_ITEM.DATE_POPUP(3,rownum,VAL,'dd-mon-yyyy'),2,HTMLDB_ITEM.TEXT(3,VAL)) VALORE
    FROM TESTID
    my table is:
    CREATE TABLE "DEV"."TESTID"
    (     "ID" NUMBER NOT NULL ENABLE,
         "FK_HTMLDB_ITEM" NUMBER,
         "VAL" VARCHAR2(4000 BYTE))
    Bye Bye

  • I ttunes wants to keep on restoring my phone and I restored a few time now but can not get past the restore screen to load my purchaseed apps etc or sync my phone with new data, it sort of does not recognise the fact that i ihave synced already. Please he

    I Tunes wants to conituiosly restore my phone and after every restore it just goes back to the restore screen and i can not get past that to get to my apps etc.  It is as if the system does noet regognise the fact that the resotre has been done.................

    Follow this very helpful user tip by wjosten:
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • Replace default table sort with order by on the view object

    The Jdeveloper help for af:table says:
    If the underlying model is not a CollectionModel , the Table automatically examines the actual data to determine which properties are sortable. Any column that has data that implements java.lang.Comparable is sortable. This automatic support cannot be nearly as efficient as coding sorting directly into a CollectionModel (for instance, by translating the sort into an "ORDER BY" SQL clause), but is sufficient for small data sets.
    I have a database table with varchar2 columns that can contain string, date or number values. So in the af:table I want to sort the columns either in string, date or number order.
    I tried creating a sort listener and in that listener set the view object order by clause and execute the query, but it does not affect the row order - it is always sorted as a string. I assume that the collection is doing its sort after I do the query, and overwriting the query order. I have tried disabling the sort in the listener by setting the sortcriteria to null but it has no effect.
    Can anyone suggest how to stop the default sort re-ordering the rows, or else how to code sorting directly into the CollectionModel as suggested in the help.
    Hugh Nelson

    By running in debug I discovered that when you click on a column heading to sort by the column values it actually sets the order by clause on the view object and executes a query. The help says that the default sorting is not as efficient as setting the order by clause - perhaps the help is out of date because default sorting does set the order by clause.
    This means that you cannot do a column sort on a transient attribute. The attribute being sorted on must exist in the table/query.
    The easiest solution is to override the setOrderByClause method on the view object. The string parameter is the column to order by eg "COLUMNA". If this column holds date values I can change it to something like "TO_CHAR(TO_DATE(COLUMNA,'DD-MON-YYYY'),'YYYYMMDD')". For numbers I do "LPAD(COLUMNA,10,'0')".
    This works OK.
    Hugh Nelson

  • Sorting Alpha and numerics in the same column

    Post Author: Jimbob
    CA Forum: General
    I need to sort a column first by alpha then numerics.  If I use the ascending sort, the records appear in the following order:
    01, 02, AA, BB, ZZ
    If I use the descending sort option, I get the following:
    ZZ, BB, AA, 02, 01
    What I need is the following order:
    AA, BB, ZZ, 01, 02, 03
    Any suggestions are greatly appreciated!
    Thanks.

    Post Author: rickcf
    CA Forum: General
    What if you create a non printing sort variable field and append a 'Z' to the beginning of only the numeric fields.
    IF Field is Numeric then append Z else just use field.
    Then you sort ascending on the variable sort field instead of just the field itself.  Im am not sure if it would put ZZ above Z01 but you can always add more Z's or play with it till it works.
    Rick
    Rick

  • Date field sorts with Null values

    We have small oracle database which is used for third party application/driver. Several tables have date type fields and somehow this driver converts null value into 01/01/0001 in some cases. However when we do select * from table order by date_field it does not look like it separates Nulls from this 01/01/0001 It kind treats this as NULL.
    Just want to hear if anybody had similar issues or this is normal for Oracle?
    Oracle Version: 10.2.0.3

    No, in the rdbms a null is a null so if a date column value is null it is handled as null. What an application or driver does is another issue. It is however possible via OCI to insert invalid date values into a date column so determining if there is invalid data in the columns is the first step I would take. That way you know if you have a data issue or a driver issue.
    HTH -- Mark D Powell --

  • Getting a error with red mark in the measures columns..

    Hello Gurus,
    When we try to run the report in analysis, In the columns its shows red mark like this..
    Please anyone can help on this issue..?
    Thanks
    PSN

    Hi
    this issue is not related to analysis for office in general
    its a GDI+ painting error, thrown by the .net framework.
    Is your windows system on the latest patches??
    Regards
    Thorsten

  • Sorting NULLS LAST in BI Publisher

    Hi all,
    Is there a way that I can sort column in descending order with NULLS LAST? Need to do that in BIP not in a querry.
    Thanks in advance,
    Stefan

    hi all,
    thx for the reply.
    i can display the data in all column. the point is i can't sort using EventParentName column.
    maybe some of you has experience like this, please share with me.
    thx
    dityo
    Edited by: user13655637 on Apr 12, 2011 7:17 PM

  • Is it possible to set the database with nulls first for all its tables ?

    Hello,
    I have a schema of 117 tables and I would like Oracle to behave nulls first when doing any order by on any tables.
    Is there a way to tell that respectable old database server to do such a thing ?
    As it is today, I have to write some custom DAO specific to Oracle just so as to have a nulls first in the sql statements.
    Kind Regards,

    user573224 wrote:
    I have a schema of 117 tables and I would like Oracle to behave nulls first when doing any order by on any tables.Basically this is an application (sql) issue. If you do not code explicitly, ascending ordering is default and also means that nulls last is the default.
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10002.htm#i2171079
    As 'nulls first' belongs to order by clause of select statment, this seems like a question for the SQL forum. {forum:id=75} That you happen to run sql on XE does not matter.
    As it is today, I have to write some custom DAO specific to Oracle just so as to have a nulls first in the sql statements.Changing how a database engine behaves seems like the opposite of dbms agnostic application, if that's the purpose. Also in general, database agnostic/ignorant applications are often considered a sure way to unscalable and unmanageable systems.
    One could also consider that customers having Oracle as part of their infrastructure, would like to see that applications make good use of Oracle's strong and highly capable features and options -- not treat it as some sort data dumping bin.
    (Ok, granted, with XE this might not be true. Instead there are issues of limitations and lack of support (patches), that you might not want or can take on as an applications vendor.)
    Btw, good to see that you've found a fix in sql for your problem, and thank you for reverting back with that to the forum!
    Edited by: orafad on Dec 7, 2012 10:29 PM
    Edited by: orafad on Dec 7, 2012 10:31 PM

  • Multiple fact column should show the value in different row.

    Hello experts,
    We have a requirement in this way. I have to build a report with three fields: date, Fact :No of jobcard open, No of jobcard closed. Report should come in this way..
    Date
    1 2 3 4 5 6 7 8 9 10
    No of jobcard open 30 45 46 67 83 28 23 45 01 92
    No of Jobcard closed 23 40 25 29 70 20 10 20 01 89
    I am new in this field, please help me in this regard.
    Regards
    Niraj
    Edited by: user13412398 on Jan 19, 2011 7:46 PM

    Hi Niraj,
    Just pull the columns into your criteria request and from compound layout select pivot view so all your columns will be in place in pivot table.
    Then you pull your columns accordingly seeing the pivot structure i.e. placing date at the top and in measure section place the fact column and in rows section place the jobcard closed.Folow these and you would get the result.
    Follow this etiquette http://forums.oracle.com/forums/ann.jspa?annID=939
    UPDATED POST
    Place both those columns in measure and the date column as you need at the top.Just play around with the pivot view by placing here and there and check results.
    So you will get idea and that will fulfill your requirement.
    Hope answers your question.
    Cheers,
    KK
    Edited by: Kranthi on Jan 19, 2011 9:34 PM

  • DataFormWebPart: Sorting with Last modified bug

    I have created a DataFormWebPart with SPD2013. In my DataFormWebPart, I sort the table by Modifed column. The column is display with follow format:
    <xsl:value-of select="ddwrt:FormatDate(string(@Modified), 2057, 5)"/>
    However, when sorting with descending order. The time at 12:xx is at higher proirity:
    24/04/2015 12:44
    24/04/2015 12:25
    24/04/2015 17:18
    24/04/2015 16:55
    24/04/2015 15:52
    Why is that? Can we fix it? Thank you.

    Thank you for your reply. I have done more test. When I press F5 to refresh the page, the sorting order is correct. However when click on the column header to sort the order is incorrect.
    There are only two sentense start with <xsl:sort
    <xsl:sort select="*[name() = $dvt_sortfield] | @*[name() = $dvt_sortfield] | text()[name(ancestor::*[1]) = $dvt_sortfield]" order="{$dvt_sortdir}" data-type="{$dvt_sorttype}" />
    <xsl:sort select="ddwrt:FormatDate(string(@Modified),2057,5)" order="descending" />
    and here is part of column with wrong order when clicking the header:
    <xsl:call-template name="dvt.headerfield" ddwrt:atomic="1" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
     <xsl:with-param name="fieldname">@Modified</xsl:with-param>
     <xsl:with-param name="fieldtitle">修改時間</xsl:with-param>
     <xsl:with-param name="displayname">修改時間</xsl:with-param>
     <xsl:with-param name="sortable">1</xsl:with-param>
     <xsl:with-param name="fieldtype">x:dateTime</xsl:with-param>
    </xsl:call-template>
    Here is how the sorting looks like:
    24/04/2015 15:52
    24/04/2015 16:55
    24/04/2015 12:44
    27/04/2015 13:49
    27/04/2015 13:53

  • Combining the same column from 2 tables with distinct result.

    I have 2 tables with identical name columns. One is current people and the other is historical people. I want a select that returns any name that is in either table. I want each name listed only once. I want to see 1 entry for each name if it is in the current table, the historical table, or both tables. I can easily do a select distinct on each table but how do I join the queries to get 1 result set with no duplicates? The name column is not a key field and I don't want any other columns from either table.

    Just a simple UNION:
    select name
      from current
    union
    select name
      from historical;

  • How map to my particular table to the fact table in obiee 11g...

    Hi friends,
    I did this simple report in obiee 11g(i.e)
    "NATIONALITY COUNT IN DEPARTMENT WISE"
    For that i used the following tables:
    per_all_assignments_f----->fact table
    hr_all_organization_units----->dim table(containing departments)
    per_all_people_f---------------->dim table(containing nationality)
    I made all the mappings in the physical diagram, as also viewed my report in BI answers
    It shows the following results like
    NATIONALITY---------------------------------------------------------------------COUNT(NATIONALITY)
    AUS------------------------------------------------------------------------------------------------24
    AFR------------------------------------------------------------------------------------------------25
    PHQ_VB-------------------------------------------------------------------------------------------40
    SH_VT----------------------------------------------------------------------------------------------4
    The problem is for me it is showing the above results, but the nationality column is of various codes of the country.
    Since i doesnt want the code of the nationalitian to display in the results..i need the meaning of each and every nationality..
    like,
    AUS------------------------Australian
    AFR-------------------------African
    PHQ_VB----------------------Germanian(assigned)
    Since i know that the meaning for the nationalitian is available in "FND_LOOKUP_VALUES"...okay..
    I can import "FND_LOOKUP_VALUES" table to the physical layer...but how i can able to give the mapping to the fact table in my physical diagram...
    In my report the fact table is "per_all_assignments_f"
    As my fact table doesnt contains any matching column corresponding to the dimension table "FND_LOOKUP_VALUES".....
    Then how i can give mappings to the fact column???? for viewing the full meaning of the nationalitian in my report.....Help me friends...
    Regards,
    Harry...

    Hi bifact,
    I followed the step that U asked me to go but im stuck with later.....
    *) I saved the query that i executed in toad with the columns showing country codes and country meaning to the excel sheet...
    This is the query that i executed in toad and copied data s in excel sheet..
    select z.lookup_code, z.meaning
    from per_all_people_f e, per_all_assignments_f f, hr_all_organization_units h, fnd_lookup_values z where
    e.person_id = f.person_id and f.organization_id = h.organization_id and e.business_group_id = f.business_group_id
    and f.business_group_id = h.business_group_id and f.location_id = h.location_id
    AND z.lookup_type(+) = 'NATIONALITY'AND z.lookup_code(+) = e.nationality and sysdate between
    e.effective_start_date and e.effective_end_date and e.nationality is not null
    *) After that i created a system DSN for the excel drive..
    *) After that when i tried to import metadata of the excel data that is saved, it showed me connection failed...
    For importing this excel data
    what connection details i need to give:--------------------
    as well as user name and also password...
    Soon after importing this excel you said that to give key connection only to fnd_lookup_tables(dim) and that excel data..
    if so, again im not giving key connection to my fact table..
    I think again the same error will occur that no logical mapping is not made to fact so again repository is inconsistent...
    Hi bifact sorry to ask you, but can you see the steps that i followed is correct and after that wat more steps i need to proceed..Can you tell me in breif manner...Thanks for your help...
    Regards,
    Harry...

  • Performance with null parameters

    The below is the main cursor for a small report with some horrible performance. The report is taking 30 to 40 minutes to generate just a few rows of data. After checking my joins and whether the indexes were correct and all the other simple things, I began removing the lines on the bottom that are just used to insert incoming parameters. What I found is that if I comment out the two lines on the bottom of the statement (with v_person_id and v_sup_id), the query returns immediately if I pass a start and end date only and leave the other parameters as null. If I run the query with those lines in and pass null for those values also, it goes back to 30 minutes or so. I am confused as passing them as null should make the line evaluate to ppf.person_id = ppf.person_id. We use this technique with all of our reporting when we pass null values but for some reason it is failing horribly in this query. Can anyone see what I am doing wrong?
    SELECT ppf.employee_number,
            ppf.full_name,
            loc.attribute3,
            loc.location_code,
            glc.segment1,
            glc.segment2,
            glc.segment3,
            org.name,
            (SELECT ppf1.employee_number||'~'||ppf1.full_name
                 FROM per_all_people_f ppf1
                WHERE trunc(sysdate) between ppf1.effective_start_date and ppf1.effective_end_date
                  AND ppf1.person_id = asg.supervisor_id
                   AND rownum = 1) supervisor,
            past.per_system_status,
            hts.approval_status
      FROM hr.per_all_people_f ppf,
              hr.per_all_assignments_f asg,
            hr.per_assignment_status_types past,
              hr.hr_all_organization_units org,
           hr.hr_locations_all loc,
            hxc.hxc_timecard_summary hts,
            hr.per_person_type_usages_f ppu,
            gl.gl_code_combinations glc,
            hr.per_person_types ppt
    WHERE ppu.effective_end_date BETWEEN ppf.effective_start_date AND ppf.effective_end_date
       AND ppu.effective_end_date BETWEEN asg.effective_start_date AND asg.effective_end_date
       AND (   (:v_start BETWEEN ppu.effective_start_date AND ppu.effective_end_date
            OR (:v_end BETWEEN ppu.effective_start_date AND ppu.effective_end_date
            OR (ppu.effective_start_date BETWEEN :v_start AND :v_end
       AND asg.primary_flag = 'Y'
       AND asg.assignment_type = 'E'
       AND asg.assignment_status_type_id = past.assignment_status_type_id
       AND asg.organization_id = org.organization_id
       AND asg.location_id = loc.location_id
       AND asg.default_code_comb_id = glc.code_combination_id
       AND ppf.person_id = ppu.person_id
       AND ppf.person_id = asg.person_id
       AND ppu.person_type_id = ppt.person_type_id
       AND ppt.user_person_type = 'Employee'
       AND ppf.person_id = hts.resource_id
       AND hts.start_time between :v_start and :v_end
       AND org.name = NVL(:v_department, org.name)
       AND loc.location_code = NVL(:v_location, loc.location_code)
       AND glc.code_combination_id = NVL(:v_gl_code_id, glc.code_combination_id)
       AND asg.supervisor_id = NVL(:v_sup_id, asg.supervisor_id)---------------------------------------------------------------
       AND ppf.person_id = NVL(:v_person_id, ppf.person_id)-------------------------------------------------------------------

    user7726970 wrote:
    Now I am more confused as we tried something similar yesterday and it did not help but your version makes it respond immediately. Thanks for this. Would you please explain a little why your version works where my version does not?
    and decode(:v_sup_id,null,'x',asg.supervisor_id) = decode(:v_sup_id,null,'x',:v_sup_id)
    and decode(:v_person_id,null,'x',ppf.person_id)  = decode(:v_person_id,null,'x',:v_person_id)that depends on your version. the example that i have posted is simply to verify if your variable is null then use a character 'x'. that is like where 'x' = 'x' which does not use any table column or simply does nothing at all. and if the variable is not null simply use the table column with the variable and i am assuming that the table column has an index on it will utilize it for performance.

  • Filter on Fact columns at report level- obiee 11g

    Hello,
    The error I am getting in my report is : Incorrectly defined logical table source (for fact table SUMM) does not contain mapping for [LEDGERFACT.CD, LEDGERFACT.YEARID].
    The Model(Physical and BMM Layer) is as follows: DIM_LF_B is joined to 2 fact tables LEDGERFACT and SUMMARY
    DIM_RPT_PARAM -> DIM_LF_B -> LEDGERFACT
    DIM_RPT_PARAM -> DIM_LF_B -> SUMMARY
    Note that the aggregation is not set for any of the Fact columns. (I am aware that all measures have to be set some aggregation type , but Client restrictions as not to edit the rpd :( )
    Now on the report front, i have pulled following columns:
    >> Col name: Description ||| Forumla: DIM_RPT_PARAM.ITEM_DESC
    >> Col name: Actual Amt ||| Formula: case when SUMMARY.MONTHID=3 and SUMMARY.YEARID=2012 then sum(SUMM.AMT_1) else 0 end
    >> Col name: Plan Amt ||| Formula: case when LEDGERFACT.YEARID=2012 and LEDGERFACT.CD=300 then sum(LEDGERFACT.AMT_1) else 0 end
    I am not able to understand as to why the BI server is throwing the error.
    I tried removing the case condition and just applying the sum(as below), and the report comes up.
    Col name: Description ||| Forumla: DIM_RPT_PARAM.ITEM_DESC
    Col name: Actual Amt ||| Formula: sum(SUMM.AMT_1)
    Col name: Plan Amt ||| Formula: sum(LEDGERFACT.AMT_1) Also for the following combination the report works
    1)
    >> Col name: Description ||| Forumla: DIM_RPT_PARAM.ITEM_DESC
    >> Col name: Actual Amt ||| Formula: sum(SUMM.AMT_1)
    >> Col name: Plan Amt ||| Formula: case when LEDGERFACT.YEARID=2012 and LEDGERFACT.CD=300 then sum(LEDGERFACT.AMT_1) else 0 end
    2)
    >> Col name: Description ||| Forumla: DIM_RPT_PARAM.ITEM_DESC
    >> Col name: Actual Amt ||| Formula: case when SUMMARY.MONTHID=3 and SUMMARY.YEARID=2012 then sum(SUMM.AMT_1) else 0 end
    >> Col name: Plan Amt ||| Formula: sum(LEDGERFACT.AMT_1)
    Any help appreciated.
    Thnks,
    Shruti
    Edited by: 970002 on Mar 28, 2013 7:18 AM

    Hi Shruthi,
    To be clear you have one table 'DIM_LF_B' and its separated out as FACT and DIM in BMM layer with respective formulas ? If yes check this http://www.varanasisaichand.com/2012/04/fact-and-dimension-from-single-source.html
    let me know if it is different
    Thanks,
    Saichand

Maybe you are looking for

  • Trouble getting wireless to work with new D-Link DIR-655 wireless router

    I have the Mac Pro with the Leopard operating system. I just recently bought a DLink DIR-655 wireless router to use with my internet. All my PC's can get online just fine, but my Mac is painfully slow and sometimes disconnects altogether. Is there so

  • Install 8.0.5 on Redhat 6 problem

    During the install of Oracle for Linux 8.0.5 on Redhat 6.0, it fails halfway thru. It appears that svrmgrl is core dumping. Does anyone have any ideas on why this is occurring? Thanks. null

  • To populate drop down in a table..

    Hi, In my Application i have a table populated from an EJB bean through a class[].... Node:GroupNode Attributes:user , name, location. User attribute is the dropdown field in table.. below values are to be  poupulated in the dropdown of the table fro

  • Opel UHP phonebook sync

    Hi All, I have a problem with my iPhone in combination with the Opel UHP carkit. Some details first: Firmware iPhone: 3.0.1 Firmware UHP: latest (updated today by dealer) The will work together but my phonebook will not sync at all. Sometimes the rec

  • SUM VALUES

    Hi I need to sum values for different CD_INDICATOR, same CD_CUSTOMER , same NM_CYCLE , same CD_STRUT, same PROFILE CD_STRUT                    NUMBER(6)                              NM_CYCLE                    NUMBER(6)                              C