How to retrieving latest row based on a column value

Hi,
Lets consider a scenario. I have a table which has a order number, count column which is our fact, a type column which contains types e.g. (A,B) with A has more priority then B. Now in our graph we are getting all rows i.e. if we have two rows in db for order #1 one for type A and one for type B, then it shows us data from both rows in graph.
But I need only to show one row of type A in this case as A has higher priority than B. The row with type B should not contribute in construction of my graph if type A for same row also exists.
I tried a solution, for which i created a new column at logical level which contain 1 for A and 0 for B. Now i put Max aggregation rule in it to get maximum value which will be row with Type A in our case. But it did not work.
How we will can achieve it in OBIEE?
Thanks.
Aasim Khan.

Hi Steve,
I have a similar requirement... one of the columns in my table is a calculated value based on several xml fields,
<?xdofx:(MATH01+MATH02+MATH03+MATH04+MATH05+AA+AA1)+((FNDCD01+FNDCD02+FNDCD03+FNDCD04+FNDCD05+MCHCD01+MCHCD02) div '8')?>
if the resultant value above is less than 62, i do no want to display this entire row in the output. could you help me wout with this?
thanks
Domnic

Similar Messages

  • Need to  color a Table row based on a Column value

    Dear Alll
    I have a requirement to color the rows of a table based on a column value in it. I have tried and surfed many useful materials over the net. but none of them solves my purpose. Please help me, I know that i can used OADataBoundValueViewObject and create a custom css file and apply color to a particular column of a table using a decode in the select statement of that VO.
    But all i need is to color a particular row with a particular color. Need your help with this ........
    Please do reply
    Best Regards
    Edited by: Antony Jayaraj on Mar 27, 2012 8:54 PM

    These posts might help you.
    How to change the row color based on Condition
    Can we colour the rows in the column of a table
    Regards,
    Peddi.

  • Formating the Row Based on one column value

    Hi Friends
    I am trying to format the Entire row based on the value of the first column in my Answers.
    Example if first column value in 'F' now i want the Entire row to be colored
    I can do conditional formating on one column but i want to do it on the entire row
    F     8.1 %     12.0 %
    E     5.2 %     3.5 %
    M     2.3 %     3.3 %
    If any one has done this or any suggestions please respond
    Thanks
    Sang

    Its a Pivot View
    F 8.1 % 12.0 %
    E 5.2 % 3.5 %
    M 2.3 % 3.3 %
    the column 1 --> F,E,M are the Product
    the column 2 --> 8.1% , 5.2% , 2.3% are the sales in year 2008
    the column 3 --> 12.0 % , 3.5 %, 3.3 % are the sales in year 2009
    So will i be able to apply the formating in pivot view based on one column to other column If yes please let me know how or
    suggest if this can be done using the BI Office , or BI publisher
    sing the BI Office i can do the formating in Excel but once i refresh the data all the formating is gone ... :(
    I am donno BI Publisher if we have to use BIP please suggest any solution its very very very urgent and important report formating they need here ....
    Thanks in advance David
    sango

  • How to exclude entire row based on single column

    Hello there,
    I'm trying to hide an entire row if column does not equal 'E' and can't seem to get it to work. Here is code i am using inside the group:
    <?for-each:current-group()?>
    <?if@row:recordType != 'E'?><?end if?>
    <?end for-each:current-group?>
    What am i missing? Also note that the column i am trying to filter on is in the xml but not being displayed in the report.
    Edited by: [email protected] on Mar 30, 2010 3:05 PM

    Hi Steve,
    I have a similar requirement... one of the columns in my table is a calculated value based on several xml fields,
    <?xdofx:(MATH01+MATH02+MATH03+MATH04+MATH05+AA+AA1)+((FNDCD01+FNDCD02+FNDCD03+FNDCD04+FNDCD05+MCHCD01+MCHCD02) div '8')?>
    if the resultant value above is less than 62, i do no want to display this entire row in the output. could you help me wout with this?
    thanks
    Domnic

  • [8i] Way to add a specific nbr of rows based on a column value? (Follow-up)

    I'm dealing with an old database that's being phased out, and here's the version info (yes, it's really old):
    Oracle8i Enterprise Edition Release 8.1.7.2.0 - Production
    PL/SQL Release 8.1.7.2.0 - Production
    CORE 8.1.7.0.0 Production
    TNS for HPUX: Version 8.1.7.2.0 - Production
    NLSRTL Version 3.4.1.0.0 - Production
    I believe Frank Kulash gave me the solution to my original question, which was:
    Sample data:
    CREATE TABLE     testabc
    (     item     CHAR(25)
    ,     qty     NUMBER(13,4)
    INSERT INTO     testabc
    VALUES ('Item1',1);
    INSERT INTO     testabc
    VALUES ('Item2',3);
    INSERT INTO     testabc
    VALUES ('Item3',1);
    INSERT INTO     testabc
    VALUES ('Item4',2); Desired results:
    ITEM                                  QTY
    Item1                               1.000
    Item2                               3.000
    --blank row
    --blank row
    Item3                               1.000
    Item4                               2.000
    --blank rowAnd the solution:
    SELECT       CASE
              WHEN c.n = 1  THEN  t.item
           END          AS item_col
    ,       CASE
               WHEN c.n = 1  THEN  t.qty
           END          AS qty
    FROM       testabc  t
              SELECT     ROWNUM     AS n
              FROM     all_objects
              WHERE     ROWNUM     <= 10     -- If you know an upper bound
           )          c
    WHERE       c.n     <= t.qty
    ORDER BY  t.item
    ,            c.n
    ;Now, it turns out there are only some items which need these extra rows, but I'm not sure if it's possible to only include extra rows for certain items or not...
    Here's my new sample data:
    CREATE TABLE     testabc1
    (     s     CHAR(1)
    ,     item     CHAR(25)
    ,     qty     NUMBER(13,4)
    INSERT INTO     testabc1
    VALUES ('*','Item1',1);
    INSERT INTO     testabc1
    VALUES ('','Item2',3);
    INSERT INTO     testabc1
    VALUES ('*','Item3',3);
    INSERT INTO     testabc1
    VALUES ('*','Item4',2);And my new desired results: (any row with an asterisk gets extra rows, if the qty is greater than 1)
    S ITEM                                  QTY
    * Item1                               1.000
      Item2                               3.000
    * Item3                               3.000
    --blank row
    --blank row
    * Item4                               2.000
    --blank rowEdited by: user11033437 on Jan 3, 2012 9:27 AM (fixed missing asterisk in desired results)

    Hi,
    Here's a slightly simpler way:
    SELECT       CASE
              WHEN c.n = 1  THEN  t.item
           END          AS item_col
    ,       CASE
               WHEN c.n = 1  THEN  t.qty
           END          AS qty
    FROM       testabc1  t
              SELECT     ROWNUM     AS n
              FROM     all_objects
              WHERE     ROWNUM     <= 10     -- If you know an upper bound
           )          c
    WHERE       c.n     <= CASE
                       WHEN  t.s  = '*'
                       THEN  t.qty
                     ELSE  1
                 END
    ORDER BY  t.item
    ,            c.n
    ;This is just like the previous solution, except that the WHERE clause, which was originally
    WHERE       c.n     <= t.qtyis now
    WHERE       c.n     <= CASE ... END
    user11033437 wrote:... And my new desired results: (any row with an asterisk gets extra rows, if the qty is greater than 1)
    S ITEM                                  QTY
    * Item1                               1.000
    Item2                               3.000
    Item3                               3.000
    --blank row
    --blank row
    * Item4                               2.000
    --blank row
    S should be '*' on the output row where item='Item3', right?
    I'm sure you know how to get the s column in the output, but, since I've already tried it:
    SELECT       CASE
              WHEN c.n = 1  THEN  '*'
           END                AS s
    ,       CASE
              WHEN c.n = 1  THEN  t.item
           END          AS item_col
    ,       CASE
               WHEN c.n = 1  THEN  t.qty
           END          AS qty
    FROM       testabc1  t
              SELECT     ROWNUM     AS n
              FROM     all_objects
              WHERE     ROWNUM     <= 10     -- If you know an upper bound
           )          c
    WHERE       c.n     <= CASE
                       WHEN  t.s  = '*'
                       THEN  t.qty
                     ELSE  1
                 END
    ORDER BY  t.item
    ,            c.n
    ;Edited by: Frank Kulash on Jan 3, 2012 11:11 AM

  • Counting rows based on a column value

    Tricky Query.No offence if this is a repeat please.
    This is a PROD issue in SYBASE.
    TableA has id_flag_listing column
    TableA
    id_flag_listing
    N
    N
    N
    N
    N
    1) If all rows are set to 'N',then my count should be 0.
       PrimaryListing
       0
    2) If there is one row which is 'Y' then this shoud be:
       id_flag_listing
       N
       N
       Y
       N
       N
       PrimaryListing
       1
    How can I count in this manner?
    Do i use decode? I am using
    Select sum(decode(flg_active),'Y',1,0))
    from TABLEA
    Will the above work.??
    I am using SQL for Sybase.
    Please guide?

    Did you even tried the SQL query I've given?
    Your table A
    SQL> SELECT flg_listing
      2  FROM
      3  (
      4     SELECT 'N' flg_listing FROM DUAL
      5     UNION ALL
      6     SELECT 'N' FROM DUAL
      7     UNION ALL
      8     SELECT 'N' FROM DUAL
      9     UNION ALL
    10     SELECT 'N' FROM DUAL
    11     UNION ALL
    12     SELECT 'N' FROM DUAL
    13  ) TABLEA;
    FLG_LISTING
    N
    N
    N
    N
    N
    Your table A, from which I count where are of 'Y' value. In these queries, I change TableA contents.
    SQL> SELECT count(*)
      2  FROM
      3  (
      4     SELECT 'N' flg_listing FROM DUAL
      5     UNION ALL
      6     SELECT 'N' FROM DUAL
      7     UNION ALL
      8     SELECT 'N' FROM DUAL
      9     UNION ALL
    10     SELECT 'N' FROM DUAL
    11     UNION ALL
    12     SELECT 'N' FROM DUAL
    13  ) TABLEA
    14  WHERE flg_listing = 'Y';
      COUNT(*)
             0
    SQL> SELECT count(*)
      2  FROM
      3  (
      4     SELECT 'N' flg_listing FROM DUAL
      5     UNION ALL
      6     SELECT 'N' FROM DUAL
      7     UNION ALL
      8     SELECT 'Y' FROM DUAL
      9     UNION ALL
    10     SELECT 'N' FROM DUAL
    11     UNION ALL
    12     SELECT 'N' FROM DUAL
    13  ) TABLEA
    14  WHERE flg_listing = 'Y';
      COUNT(*)
             1
    SQL> SELECT count(*)
      2  FROM
      3  (
      4     SELECT 'N' flg_listing FROM DUAL
      5     UNION ALL
      6     SELECT 'N' FROM DUAL
      7     UNION ALL
      8     SELECT 'Y' FROM DUAL
      9     UNION ALL
    10     SELECT 'Y' FROM DUAL
    11     UNION ALL
    12     SELECT 'Y' FROM DUAL
    13  ) TABLEA
    14  WHERE flg_listing = 'Y';
      COUNT(*)
             3Yoann.

  • How to restrict a table with its set of data based on a column value in it?

    Hi,
    I have a scenario in which I have to show a set of data of a pivot table by restricting data based on a column value. I am creating BIP report whose source is from BIA ie.RPD. Based on a column value I want to restrict the data being displayed in the table. Since I also want the hidden data in the first table to be displayed in another table in the same report I cannot restrict the data at the query level i.e at RPD or at BIA. For this reason I used
    <?xdofx:if saw3_ = 1?>
    the pivot table
    <?end if?>
    But it does not restrict any data.
    Also I tried using the if condition inside the table before the row level looping happens. But no good show even then.
    How can I forgo this problem?
    Regards,
    The MM

    Hi,
    See : http://download.oracle.com/docs/cd/E12096_01/books/PubUser/T421739T481157.htm#4535373 regarding column and row.
    Regards,
    Colectionaru

  • Deleting duplicate rows based on three columns in Oracle 8i

    Hi all,
    The database we use is Oracle 8i.
    The query below raises the too_many_rows exception when I launch an application. So I want to delete the duplicated rows :
    select polarisation_1, polarisation_2
    into v_pol1_tech, v_pol2_tech
    from v_cfh_lien_element
    where nom_lien = p_nom_lien
    AND num_canal_1 = p_num_canal_1
    AND freq_emise_1 = p_freq_emise_1;
    Notice that with many possible values of the parameters p_nom_lien, p_num_canal_1 and p_freq_emise_1 then the exception is raised.
    So how to delete generally the duplicated rows based on the three columns "nom_lien" , "num_canal_1" and "freq_emise_1" ?
    Thank you very much indeed.

    Check the other thread with same question deleting duplicate rows based on three columns in Oracle 8i

  • How to handle vendor discounts based on the qty / value procured.

    Hello
           How to handle vendor discounts based on the qty / value procured.
    a.       Scenario: you have entered into a contract with vendor that you will buy goods worth Rs 10000/- and if you buy goods worth more than 100000 the vendor says he will give a discount of Rs 5000/- @ the end of the year.  
    i)                    How to handle this sceneriou2019s with SAu2019s
    ii)                   What does STD SAP offer.
    Regards
    Sapman man

    Hi,
    For the discucount condition type, you have to maintain scales.
    Take Condition type -  Discount Value ( RB00)
    Discount Value ( RB00) - Means Fixed discount. For this condition type, you have to maintain Scale basis as Value scale 'B' in the condition type customization.
    Transcation : M/06
    Select your condition type RB00 and click on the details icon.
    In the Scales block, you have to maintain and save.Calculation type = Fixed amount
    Scale basis = Value scale 'B'
    For this condition type, you have to maintain scales in the inforecord.
    Transcation : ME12
    Select this condition type, click on the Scales icon. There you have to maintain like
    From : 10,0000            Rate: 5000.
    It means, if the document value is reached 10,0000 then discount is 5000rs. If the value islessthen the 10,0000 then no discount.
    Regards
    KRK

  • Join all rows bases on one column value

    Hi All,
    I have requrement like Join all rows bases on one column value, i am not getting how to accomplish that. Here is my requrement. i have table test(id,id_desc) with no key
    table:Test
    id id_desc
    1 desc_a
    1 desc_b
    1 desc_c
    Now the requremnet i have one more table as test1(id,id_desc) here id is primary key. where record i need to insert as
    id id_desc
    1 desc_a
    desc_b
    desc_c

    orza wrote:
    Hi All,
    I have requrement like Join all rows bases on one column value, i am not getting how to accomplish that. Here is my requrement. i have table test(id,id_desc) with no key
    table:Test
    id id_desc
    1 desc_a
    1 desc_b
    1 desc_c
    Now the requremnet i have one more table as test1(id,id_desc) here id is primary key. where record i need to insert as
    id id_desc
    1 desc_a
    desc_b
    desc_cI'm guessing you want to pivot the results in TEST and use that to insert into TEST1?
    If so this may be useful
    http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php

  • How to query a row based on its rownum

    Dear all,
    what is the easiest way to query a row based on its rownum? Suppose I have the following query:
    select first_name from employees where rownum<5;
    FIRST_NAME
    Ellen
    Sundar
    Mozhe
    DavidSo Ellen has rownum 1, Sundar 2 and so on. How can I do it if I just want to query a row where Mozhe is the first_name, which is rownum 3?
    Best regards,
    Val

    JS1 wrote:
    Valerie Debonair wrote:
    I was thinking how oracle assign a rownum in a table is by how it populates the rows in the table.Hence a statement "based on its availability". Maybe my way of thinking it's not accurate?
    You are correct, your way of thinking is wholly innaccurate. Something that can easily be confirmed simply by reading the documentation:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns009.htm#i1006297
    okie doke... thanks for the correction

  • Delete duplicate rows -- based on 4 columns -- how?

    I asked this question on how to delete duplicates recently and received this suggestion which works well -- except --
    With CTE AS
    SELECT *, ROW_NUMBER() OVER (Partition by fld1 order by fld1) RowNum
    FROM #tmpA
    DELETE From CTE
    WHERE RowNum > 1
    -- the actual table I need to delete duplicate rows on is based on 4 columns.  The following table contains 14,462 rows of which 14,348 are distinct -- based on the following 4 colums.  Below is an image of a sample of the data contained in the
    table for my question and to the right of that data is the column structures (data types).  Is it possible to do something like the above example suggestion with the table in the image below?  How to do that?  I need to delete rows so that 14462
    goes down to 14348.  If I only reference one column for the delete -- this would delete like 7000+ rows.  I only need to remove 114 rows.
    Rich P

    Add the other 3 columns to the partition.
    Jason Long

  • How to retrieve the  row  in a jtree

    hello
    how to retrieve the current row of database when i click on a particular node in a jtree.
    i had tried it in this way->
    ViewObject vv=(panelBinding.getApplicationModule()).findViewObject("BranchMasterView1");
    Row r=vv.getCurrentRow();
    but it is not working.
    actually i have to retrieve the code of a branch after clicking on a particular branch node.
    thank you

    When the node is clicked, get the user object from the clicked node. That will be a JUTreeNodeBinding. From that object you can get what you want.
    Sascha

  • How to suppress a row based on current date -  at query level?

    In an Bex query report i have suppress rows based on current date.
    There is no current date available in query.
    there is a date field in the query.
    If by chance the date in that field is lesser than current date, I have to suppress that row.
    How can this be achieved?

    What is the code ofr creating a variable to get values >= to current date?
    I have implemented the following code which is not working.
    data L_S_range like line of E_T_range[].
    CLEAR L_S_RANGE.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'GE'.
    L_S_RANGE-LOW = SY-DATUM.
    APPEND L_S_RANGE TO E_T_RANGE[].
    Actually i have written in class, which will be inherited in superclass.
    Edited by: akshara20 on Feb 2, 2011 1:21 PM

  • How to get  current row(Based on Radio button check)  submit button Click

    Hi i hava Query Region Search(Based On Auto Customization Criteria).
    For Showing Results iam Using Table Region.
    Using Radio button How we get the row reference value using Submit button Click.
    Please Help on this .
    Thanks & Regards
    San

    Hi san ,
    Try this
    if ("EventID".equals(pageContext.getParameter(EVENT_PARAM)))
    String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    OARow row = (OARow)am.findRowByRef(rowRef);
    VORowImpl lineRow = (YourVORowImpl)findRowByRef(rowRef); // Replace your vo name .
    Please refer this link , Let me know if its not clear .
    Single Selection in table Region in OAF .
    Keerthi

Maybe you are looking for