Calculate difference based on values from 2 different columns

Hello friends,
I want to basically do something like below which is in T-SQL Format :
SUM(CASE columnA WHEN 'ABC' THEN 1 ELSE 0 END) - SUM(CASE columnB WHEN 'XYZ' THEN 1 ELSE 0 END)
For which I was changing the code to following in Oracle :
SUM(CASE columnA='ABC' THEN 1 ELSE 0 END) - SUM(CASE columnB='XYZ' THEN 1 ELSE 0 END)
But its failing validation with an error message - missing right paranthesis....
Rest of the qry is fine and whenever I add this line it starts failing.
Edited by: Sweta on 11-Sep-2009 09:32

Try this
SUM (CASE
                 WHEN columna = 'ABC'
                    THEN 1
                 ELSE 0
              END)
       - SUM (CASE
                 WHEN columnb = 'XYZ'
                    THEN 1
                 ELSE 0
              END)or
COUNT (CASE
                   WHEN columna = 'ABC'
                      THEN 1
                END)
       - COUNT (CASE
                   WHEN columnb = 'XYZ'
                      THEN 1
                END)Remark : you can use this sythax in oracle
SUM(CASE columnA WHEN 'ABC' THEN 1 ELSE 0 END) - SUM(CASE columnB WHEN 'XYZ' THEN 1 ELSE 0 END)Example
SELECT emp_test.*,CASE ename
          WHEN 'SCOTT'
             THEN 1
       END ind
  FROM emp_test
     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO        IND
      7369 SMITH      CLERK           7902 1980-12-17        800                    20          
      7499 ALLEN      SALESMAN        7698 1981-02-20       1600        300         30          
      7521 WARD       SALESMAN        7698 1981-02-22       1250        500         30          
      7566 JONES      MANAGER         7839 1981-04-02       2975                    20          
      7654 MARTIN     SALESMAN        7698 1981-09-28       1250       1400         30          
      7698 BLAKE      MANAGER         7839 1981-05-01       2850                    30          
      7782 CLARK      MANAGER         7839 1981-06-09       2450                    10          
      7788 SCOTT      ANALYST         7566 1987-04-19       3000                    20          1
      7839 KING       PRESIDENT            1981-11-17       5000          0         10          
      7844 TURNER     SALESMAN        7698 1981-09-08       1500                    30          
      7876 ADAMS      CLERK           7788 1987-05-23       1100                    20          
      7900 JAMES      CLERK           7698 1981-12-03        950                    30          
      7902 FORD       ANALYST         7566 1981-12-03       3000                    20          
      7934 MILLER     CLERK           7782 1982-01-23       1300                    10          
14 rows selected.

Similar Messages

  • Getting 2nd Least Value from Different Column

    Hi there All,
    I have one odd requirement.
    I hava table which has diffrent columns of numeric Datatype.
    The task is to get the least values from the table.
    I can take the least value by least(col1,col2,col3 ...) function.Until this stage it is fine.
    But also I have take 2nd least value and 3rd least value, which I am quite unsure how to get it.
    Looking forward for suggestions.
    Thanks in Advance.
    Regards,
    Ajeet

    The following is a generic solution that will allow you to select the nth least and allow you to pass as many column names as you like and will return null if the nth least requested exceeds the number of distinct values. The nleast function that I wrote uses the str2tbl function by Tom Kyte. I have included a demonstration of its usage below. The value returned for the 1st least is the same as that returned by the least function.
    This should have been posted on the SQL and PL/SQL discussion group of these forums, rather than the general database. I also posted the same response in the SQL discussion group of the Orafaq forums.
    scott@ORA92> -- test data:
    scott@ORA92> SELECT * FROM your_table
      2  /
          COL1       COL2       COL3
             1          2          3
             4          6          5
             8          7          9
            11         12         10
            15         13         14
            18         17         16
    6 rows selected.
    scott@ORA92> -- type and functions:
    scott@ORA92> create or replace type myTableType as table of number;
      2  /
    Type created.
    scott@ORA92> create or replace function str2tbl( p_str in varchar2 )
      2  return myTableType
      3  as
      4        l_str      long default p_str || ',';
      5        l_n         number;
      6        l_data    myTableType := myTabletype();
      7  begin
      8        loop
      9            l_n := instr( l_str, ',' );
    10            exit when (nvl(l_n,0) = 0);
    11            l_data.extend;
    12            l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
    13            l_str := substr( l_str, l_n+1 );
    14        end loop;
    15        return l_data;
    16  end;
    17  /
    Function created.
    scott@ORA92> CREATE OR REPLACE FUNCTION nleast
      2    (p_n        IN NUMBER,
      3       p_nums        IN VARCHAR2)
      4    RETURN           NUMBER
      5  AS
      6    v_nleast      NUMBER;
      7  BEGIN
      8    SELECT DISTINCT column_value
      9    INTO   v_nleast
    10    FROM   (SELECT column_value,
    11                  DENSE_RANK () OVER (ORDER BY column_value) AS num_rk
    12              FROM   (select *
    13                   from   table (CAST (str2tbl (p_nums) AS mytabletype)))
    14             WHERE   column_value IS NOT NULL)
    15    WHERE  num_rk = p_n;
    16    RETURN v_nleast;
    17  EXCEPTION
    18    WHEN OTHERS THEN RETURN NULL;
    19  END nleast;
    20  /
    Function created.
    scott@ORA92> SHOW ERRORS
    No errors.
    scott@ORA92> -- query:
    scott@ORA92> SELECT col1, col2, col3,
      2           LEAST (col1, col2, col3) AS the_least,
      3           nleast (1, col1 || ',' || col2 || ',' || col3) AS first_least,
      4           nleast (2, col1 || ',' || col2 || ',' || col3) AS second_least,
      5           nleast (3, col1 || ',' || col2 || ',' || col3) AS third_least,
      6           nleast (4, col1 || ',' || col2 || ',' || col3) AS fourth_least
      7  FROM   your_table
      8  /
          COL1       COL2       COL3  THE_LEAST FIRST_LEAST SECOND_LEAST THIRD_LEAST FOURTH_LEAST
             1          2          3          1           1            2           3
             4          6          5          4           4            5           6
             8          7          9          7           7            8           9
            11         12         10         10          10           11          12
            15         13         14         13          13           14          15
            18         17         16         16          16           17          18
    6 rows selected.

  • Get millisecond values from timestamp column in v$logmnr_contents

    Hello
    How do we get millisecond values from timestamp column in v$logmnr_contents.
    I tried with following query.
    select scn,To_Char(timestamp,'DD-MON-YYYY HH24:MI:SS:FF') from v$logmnr_contents WHERE OPERATION NOT IN('START') and username ='SCOTT' and sql_redo is not null and (seg_owner is null or seg_owner not in('SYS'));
    it says ORA-01821: date format not recognized. I want to find the relation of scn with timestamp. In forums i found, scn is derived from timestamp value. I dont know its correct or not.
    if i query with out FF in time format i get like
    scn timestamp
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    if scn is derived from timestamp with milliseconds, each scn should be different right?More help please

    May be there's an easy way solving your problem, I did it like that:
    CREATE TABLE quota_test (test VARCHAR2(50))
    INSERT INTO quota_test
    VALUES ('update "SCOTT"."NEWTAB1" set a="34" and b="45"')
    SELECT test normal, REPLACE(SUBSTR(test,INSTR(test,'"',1),INSTR(test,'.',1)+2),'"','') changed
    FROM quota_test
    Result is :
    NORMAL
    update "SCOTT"."NEWTAB1" set a="34" and b="45"      
    CHANGED
    SCOTT.NEWTAB1
    If you didn't understand, I can explain what I wrote

  • How to create a new row for a VO based on values from another VO?

    Hi, experts.
    in jdev 11.1.2.3,
    How to create a new row for VO1 based on values from another VO2 in the same page?
    and in my use case it's preferable to do this from the UI rather than from business logic layer(EO).
    Also I have read Frank Nimphius' following blog,but in his example the source VO and the destination VO are the same.
    How-to declaratively create new table rows based on existing row content (20-NOV-2008)
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
    I have tried:
    1.VO1(id,amount,remark1) and VO2(id,amount,remark2) are based on different EO,but render in same page,
    2.Drag and drop a Createwithparams button for VO1(id,amount,remark),
    3.add: Create insertinside Createwithparams->Nameddata(amount),
    4.set NDName:amount, NDValue:#{bindings.VO2.children.Amount}, NDtype:oracle.jbo.domain.Number.
    On running,when press button Createwithparams, cannot create a new row for VO1, and get error msg:
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: For input string: "Amount"
    java.lang.NumberFormatException: For input string: "Amount"
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    Can anyone give some suggestions?
    Thanks in advance.
    bao
    Edited by: user6715237 on 2013-4-19 下午9:29

    Hi,CM,
    I'm really very appreciated for your quick reply! You know, today is Saturday, it's not a day for everyone at work.
    My principal requirement is as follows:
    1.select/check some rows from VO2, and for each selection create a new row with some attributes from VO2 as default values for VO1's corresponding attributes, and during this process the user may be cancel/uncheck or redo some of the selections.
    --so it's better to implement it in UI rather than in EO.
    2.it's better to implement this function with declarative way as in Frank Nimphius' blog.
    --little Jave/JS coding, the better. I only have experience in ORACLE FORMS, little experience in JAVA/JS.
    In order to get full information for the requirements of my use case, can take a check at:
    How to set default value for a VO query bind variable in a jspx page?
    (the end half of the thread: I have a more realworld requirement similar to the above requirement is:
    Manage bank transactions for clients. and give invoices to clients according to their transaction records. One invoice can contain one or many transactions records. and one transaction records can be split into many invoices.
    Regards
    bao
    Edited by: user6715237 on 2013-4-19 下午11:18
    JAVE->JAVA

  • Making whole row coloured red based on value in one column in BI Answers.

    Hi
    Would anyone know how to make a whole row red (eg) based on the value from one column within the row in
    a BI Answers report in either a pivot table or a table view. I know it should be a case of setting up the
    conditional formatting in the Conditional Tab on the Properties of the column, but all the columns apart from the
    one with the value being determined ignore the value in another column.
    Thanks,
    - Pete
    Edited by: user1636556 on 09-Dec-2011 07:58

    Hi
    Would anyone know how to make a whole row red (eg) based on the value from one column within the row in
    a BI Answers report in either a pivot table or a table view. I know it should be a case of setting up the
    conditional formatting in the Conditional Tab on the Properties of the column, but all the columns apart from the
    one with the value being determined ignore the value in another column.
    Thanks,
    - Pete
    Edited by: user1636556 on 09-Dec-2011 07:58

  • Dynamically display title based on value selected in column selector

    Hi All,
    Can it be possible to show the report title dynamically based on value selected in column selector . suppose i have two column status and region . When i will select status in the column selector the title of the report will show " Status Summary" when i will select region then the title will change to "Region Summary". Please help me...

    Hi,
    create dashboard prompt with column selector functionality like following way
    write the following query in your dashboard prompt sql results
    select region name from subject area name
    Union all
    select sub_region name from subject area name
    like this and put one presentation variable for this dashboard prompt like var1
    in your report write formula in your column like this *case when @{var1)='region column' then 'Region Summary' else ' ' end*
    and refer this column in narrative view like @1 then narrative act like a title view.
    Hope this helps you
    Regards
    Naresh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Retrieving multiple values from one column in SELECT statement

    Hi,
    I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
    If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
    When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
    e.g.
    at the DB level :
    SELECT role_name, CC_ID FROM votetbl a
    INNER JOIN APPROVERS b ON
    a.BUSVP = b.BUSVP AND
    a.BRANCH = b.BRANCH
    WHERE CC_ID = 1688this will return:
    ROLE_NAME CC_ID
    ops 1688
    ops 1688
    comply 1688
    legal 1688
    comply 1688
    When run in my JSP, like so:
    String primID3a = request.getParameter("primID");
    Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
                         "a.BRANCH = b.BRANCH WHERE CC_ID = ?";
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    out.println("Vote category: "+votecat);I only get ops returned.
    Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
    Any feedback and direction here is welcomed!
    Thanks!

    Actually, I tried looping and still only get 1, but returned several times.
    i.e.
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    while (rest3.next()) {
    out.print("category roles "+votecat);
    }then I get returned the following:
    admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
    like so.
    Where as at the DB level I get
    ROLE_NAME CC_ID
    admin 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    risk 1688
    comply 1688
    legal 1688
    legal 1688
    ops 1688
    comply 1688
    Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
    Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
    I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
    Other times, it will not return a value at all, even though one resides in the db.
    Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
    Yeeeeeeesh!!! : (
    Message was edited by:
    bpropes20

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • List values from different prompts into one.

    Hi All,
    We have OBIEE 11g and building Analysis out of Essbase cube. Here is our Requirement we need to build a Dashboard prompt which shows values from different tables.
    All these tables belong to one dimension and this has about 10 tables in it. So the prompt which we build should pick specific values from each table.
    I know we can build prompt for every table which we will end up with 10 prompts which doesn't look good so we need to show all the values of these ten prompts in single drop down (One Prompt)which we can use for refreshing the dashbaord.
    Say we have table names as Gen1.Organisation, Gen2.Organisation,.........Gen10.Organisation
    Thanks,
    Shashank

    are there any dependancies on the selections e.g if you pick Gen1.Organisation1 does this mean that you can only pick Gen2.OrgA or Org B?
    if there are no dependancies and you want all possible combinations across ten tables then you are looking at one huge drop down list !!

  • Reading values from lookup columns through custom workflow in SharePoint 2013

    We are able to read the values of text, number columns through custom workflow (via coding) in SharePoint 2013. However, we are not able to read values from lookup columns. So, request anyone to provide help on this.
    Thanks & regards,
    Aditya

    Hi,
    According to your post, my understanding is that you want to read values from lookup columns through custom workflow in SharePoint 2013.
    Since the workflow just doesn't get lookup fields, let's give it something static to work with instead. If we can capture the ID of the lookup field and store that as a static value in our list, the workflow can happily use that to look up our related.
    For more information, you can refer to:
    SharePoint 2013 Workflows and Lookup Columns
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • Can I assign a task based on information from another column?

    For example:
    Let's say I have a column called "Question Type" and this column has multiple checkbox choice, those being:
         Math
         Science
         History
         English
         Other
    I want to allow users to be able to select multpile catagories for the question, like making one both math and science (which right now is completely possible)
    I then want another column that says who the problem is assigned to. Bob is good at math, Joe at science, Jill at histroy, Jenn at English, and Billy handles everything else.
    1) Is there a way that the task can be automatically assigned to my math expert Bob when I specify that the item I am adding is a math problem?
    2) If I make a problem both math and science, can the task be assigned to both Bob and Joe?
    Thanks in advance!

    Hi,
    According to your post, my understanding is that you wanted to assign a task based on information from another column.
    To assign task to multiple users, you need to:
    Create a workflow and add action: Start Approval Process.
    Click these user, select the Group, change One or a time(serial) to
    All at onec(paralle).
    Right click the action, select Properties, click ExpandGroups, change No to
    Yes.
    Then you can assign task to each member of the group.
    I recommend to follow the steps as below to achieve what you want:
    Create a custom list, add columns: Question Type(Choice); Assigned to(Person or Group).
    Create a workflow associated the list.
    Add conditions and action as below:
    Then the task can be automatically assigned to 123 when the item is a math problem.
    In addition, if you make a problem both math and science, the task can be assigned to both 456 and 789.
    You can add other conditions to satisfy all the requirements.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How find out the duplicate value from each columns.

    I have below four columns,
    How can i find out the duplicate value from each columns.
    with All_files as (
    select '1000' as INVOICE,'2000' AS DELIVERYNOTE,'3000' CANDELINVOICE,'4000' CANDELIVERYNOTE from dual union all
    select '5000','6000','7000','8000' from dual union all
    select '9000','1000','1100','1200' from dual union all
    select '1200','3400','6700','8790' from dual union all
    select '1000','2000','3000','9000' from dual union all
    select '1230','2340','3450','4560' from dual
    SELECT * FROM All_files
    Output should be as per below.
    1000 2000 3000 4000
    9000 1000 1100 1200
    1200 3400 6700 8790
    1000 2000 3000 9000
    Required to check uniqueness in cross columns.
    Thanks.

    Try this (sorry about the formatting)...
    WITH all_files AS (SELECT   '1000' AS INVOICE,
                                '2000' AS DELIVERYNOTE,
                                '3000' CANDELINVOICE,
                                '4000' CANDELIVERYNOTE
                         FROM   DUAL
                       UNION ALL
                       SELECT   '5000',
                                '6000',
                                '7000',
                                '8000'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '9000',
                                '1000',
                                '1100',
                                '1200'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1200',
                                '3400',
                                '6700',
                                '8790'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1000',
                                '2000',
                                '3000',
                                '9000'
                         FROM   DUAL
                       UNION ALL
                       SELECT   '1230',
                                '2340',
                                '3450',
                                '4560'
                         FROM   DUAL),
        t_base
           AS (SELECT      invoice
                        || ','
                        || deliverynote
                        || ','
                        || candelinvoice
                        || ','
                        || candeliverynote
                           str
                 FROM   all_files),
        t_str
           AS (SELECT   str || ',' AS str,
                        (LENGTH (str) - LENGTH (REPLACE (str, ','))) + 1
                           AS no_of_elements
                 FROM   t_base),
        t_n_rows
           AS (    SELECT   LEVEL AS i
                     FROM   DUAL
               CONNECT BY   LEVEL <=
                               (    SELECT   SUM (no_of_elements) FROM t_str)),
        t_build AS (SELECT   t_str.str,
                             nt.i AS element_no,
                             INSTR (t_str.str,
                                    DECODE (nt.i, 1, 0, 1),
                                    DECODE (nt.i, 1, 1, nt.i - 1))
                             + 1
                                AS start_pos,
                             INSTR (t_str.str,
                                    1,
                                    DECODE (nt.i, 1, 1, nt.i))
                                AS next_pos
                      FROM      t_str
                             JOIN
                                t_n_rows nt
                             ON nt.i <= t_str.no_of_elements),
        t_build2
           AS (SELECT   RTRIM (str, ',') AS original_string,
                        SUBSTR (str, start_pos, (next_pos - start_pos))
                           AS single_element,
                        element_no
                 FROM   t_build),
        t_build3
           AS (SELECT   single_element,
                        COUNT( * )
                           OVER (PARTITION BY single_element
                                 ORDER BY single_element)
                           ele_count
                 FROM   t_build2)
    SELECT   DISTINCT INVOICE,
                      DELIVERYNOTE,
                      CANDELINVOICE,
                      CANDELIVERYNOTE
      FROM   all_files, t_build3
    WHERE   ele_count > 1
             AND (   INVOICE = single_element
                  OR DELIVERYNOTE = single_element
                  OR CANDELINVOICE = single_element
                  OR CANDELIVERYNOTE = single_element)I think this will be faster than the previous solution?
    Cheers
    Ben
    Edited by: Munky on Feb 17, 2011 2:11 PM - "I think this will be faster than the previous solution?", nope - it's not :(

  • How do you lookup multiple values in different columns based on variable criteria?

    Essentially, I'd like to be able to do a Vlookup but instead of searching for one value only, search for multiple values in separate columns. A smaller version of my current spreadsheet as an example...
    Attack Type ->
    Fire
    Water
    Grass
    Fire
    1/2x
    2x
    1/2x
    Water
    1/2x
    1/2x
    2x
    Grass
    2x
    1/2x
    1/2x
    Fire/Water
    1/4x
    1x
    1x
    Fire/Grass
    1x
    1x
    1/4x
    Grass/Water
    1x
    1/4x
    1x
    The headers are the attack types and the list of types to the left are the receiving Pokemon. Fire does half damage (1/2x) to fire types, Water does double damage (2x) to fire types, etc. I'd like to be able to search for specific damages for each type. For example, I'd like to find a Typing that recieves half (1/2x) damage from Fire-type attacks but also recieves double (2x) from Grass-type attacks. I do want more than just two search criteria though seeing as the actual table is much, much larger.
    I've tried assigning number values to each damage multiplier and then merging all of them together for a specific typing and doing a VLOOKUP based on checkboxes determining what damage multiplier I want in a few specific types, the rest being filled in to the standard of 1x but the result isn't correct most of the time.

    Hi Mitchell,
    VLOOKUP can be set for accept either an 'exact match' or a 'close match'.  Your 17 digit 'number' is actually a 17 character text string (Numbers can handle numbers to a precision of only 15 places). Provided all 17 digits are present, sorting should be the same as for numerical values—the leftmost character is the most significant.
    As a text string, your 'number' is sorted/evaluated alphabetically. A 'close match' accepts the 'largest value that is less than or equal to the search value'.
    If your search term is 000200000 (a 9 character string), several 'wrong' answers will fit the 'close match' criteria, including all of those listed below:
    000200000 (the 'correct' match)
    0000xxxxx (x may be any of the three acceptable values)
    0001xxxxx (x may be any of the three acceptable values)
    The main problem here is that digits in a number (or characters in a text string) have decreasing significance related to their distance from the beginning of the string/number. You want a search in which each character has the same significance as each of the others when compared to the search key. To do that, you need to compare each character in the search string with the character in the same position in the similar string for each type of Pokemon, then take a count of the matches or a sum of the differences.
    Here's one approach:
    Column A contains labels.
    Column B, the 17 digit search term, created in whatever manner you wish, and the similar 17 digit string for each of the characters.
    Columns C through S contains a formula that detines, using subtraction, the difference between each digit of the search term and the corresponding digit of each character's profile.
    Column C uses SUM() to calculate the total of columns C to S for each row.
    T1 uses =MIN(T) to calculate "least different" profile.
    Column A is a Header column; Row 1 is a Header row.
    Formulas:
    C2, and filled right to S2, then down to the last row of data:
    =ABS(MID($B$1,COLUMN()-2,1)-MID($B2,COLUMN()-2,1))
    T1: =MIN(T)
    T2, and filled down column T: =SUM(C2:S2)
    The conditional formatting rule set for all body cells in column T is shown below the table.
    This may be enough to get you started. Formulas can be tweaked to produce results more closely matching what you're looking for, if necessary.
    Regards,
    Barry

  • Redirecting to different pages based on value from table linked from report

    Hi,
    I wanted to navigate to different pages from a report link based on a value from the table on which the report is built. I was able to link to particular page without any problem.
    But, I wanted to link to different pages based on value in the table. Please let me know how can I do this?
    Thanks,

    kaminey wrote:
    Hi,
    I wanted to navigate to different pages from a report link based on a value from the table on which the report is built. I was able to link to particular page without any problem.
    But, I wanted to link to different pages based on value in the table. Please let me know how can I do this?APEX version?
    Is this a standard or interactive report?
    How does the value from the table determine the target page used in the link? Is it a page number? Or the result of some computation or process?
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.

  • Navigate from report to dashboard and  pass values between different column

    Hello
    I have a question about navigating from 1 report to a dashboard page while passing the value from column 1 to column 2 in the second report...
    In OBIEE 11G, I create action link on report 1, column 1 and this action link is navigate to BI Content and the destination is a dashboard page, which has column 2 used as dashboard prompt and there are 3 reports all use column 2 to filter. Now the column 2 in the dashboard page is an alias of column 1 from report 1, from user's point of view they are the same, but from OBIEE point of view they are different.
    My action link is able to navigate to dashboard, however, the value in column 1 which I clicked to execute the navigation, does not get passed to column 2 as the dashboard prompt doesn't get this value upon navigation..
    Since I can't put column 1 in dashboard 2 nor can I put column 2 in report 1. Because our data model is done in the way that if I use column 1 or column 2 in both places, it will be circular joins...
    Is there a way around this issue?
    Let me know if I need to provide more clarification
    Thanks

    Sid
    Here is the thing..
    Let's say we have Dimension 1, dimension 2 and fact 1 and fact 2
    In one report, you need to show Dimension 2 and fact 1 so Dimension 2 joins to fact 1.
    In some other cases, you need to shown dimension 1 and fact 2 stuffs, but dimension 1 can't get to fact 2 without going through dimension 2. So Dim 1 --> Dim 2 --> Fact 2
    Then in some other cases, you need to show Dim 1 and Fact 1 reports..
    In means, your model will look at:
    Dim1 --> DIm2 and Dim 1 --> Fact 1 and Dim 2 --> Fact 1.. This is just a simpler version of a much more complex model that I am dealing with now..
    So in this case, you can't just use Dim 1 attributes across the board. For some dashboards, you will have to create alias of Dim 1, call it A1_Dim1, un-join Dim1 with Dim 2 or to fact 1 to avoid circular joins... Then in different reports, you either use columns from Dim 1 or A1_Dim1..
    Now Dim1 and A1_DIM1 are really the same thing, but they are not according to OBIEE...
    So my problem is, in report 1 where Dim1 is used, it can't past values to Dashboard 2 where A1_DIM1 is used as dashboard prompt..
    I want to know if there is a way around this issue
    Hope this makes more sense now
    Thanks

Maybe you are looking for