Sorting columns dynamically using Presentation Variables

Hi,
I have 4 measures say A,B,C,D , a period dimension and branch name dimension. I would like to select the measure in the prompt and the result should display rank for the selected measure using presentation variables. For eg: If measure-A is selected, the result should be arranged in order by based on "A".
Is it possible to sort the columns dynamically?
Kindly help me.
Regards,
RB

Hi RB,
You can do that, though it's a bit more complicated than a simple SQL statement. For example:
WITH BASEDATA AS (
SELECT
  EMPNO,
  ENAME,
  MGR,
  SAL,
  COMM,
  CASE WHEN :P4_SORT_ORDER = 1 THEN
    ROW_NUMBER() OVER (ORDER BY UPPER(ENAME))
  WHEN :P4_SORT_ORDER = 2 THEN
    ROW_NUMBER() OVER (ORDER BY (SELECT NVL(MIN(UPPER(E2.ENAME)),'-Select-') FROM EMP E2 WHERE E2.EMPNO = EMP.MGR))
  WHEN :P4_SORT_ORDER = 3 THEN
    ROW_NUMBER() OVER (ORDER BY (SELECT NVL(MIN(UPPER(E2.ENAME)),'-Select-') FROM EMP E2 WHERE E2.EMPNO = EMP.MGR), UPPER(ENAME))
  WHEN :P4_SORT_ORDER = 4 THEN
    ROW_NUMBER() OVER (ORDER BY UPPER(ENAME) DESC)
  WHEN :P4_SORT_ORDER = 5 THEN
    ROW_NUMBER() OVER (ORDER BY (SELECT NVL(MIN(UPPER(E2.ENAME)),'-Select-') FROM EMP E2 WHERE E2.EMPNO = EMP.MGR) DESC)
  WHEN :P4_SORT_ORDER = 6 THEN
    ROW_NUMBER() OVER (ORDER BY (SELECT NVL(MIN(UPPER(E2.ENAME)),'-Select-') FROM EMP E2 WHERE E2.EMPNO = EMP.MGR) DESC, UPPER(ENAME) DESC)
  END SORTITEM,
  'O' STATUS
FROM
  EMP
SELECT
  EMPNO, 
  ENAME,
  MGR,
  SAL,
  COMM
FROM
  BASEDATA
ORDER BY
  SORTITEMUsing a CASE statement this assigns a ROW_NUMBER to every record based on its ordering within the selected ORDER BY clause. The output is then sorted by this value.
Andy

Similar Messages

  • Unresolved column when using presentation variable in Answers filter

    Hi all,
    I'm using a dashboard prompt that sets a presentation variable - pres_year. I'm using the presentation variable in a request's filter.
    In the 'Criteria' tab, in the filter for the request, I set a year column (YEAR) to the presentation variable via Variable Expr and enter the presentation variable name only. End up with:
    YEAR is equal to / is in @{pres_year}
    When using the dashboard, the prompt and request all work fine. The problem is when I'm in the request in Answers and I click on 'Display Results' button. I get the following error:
    'NQSError: 27005 unresolved column pres_year'
    Any suggestions?
    Thanks.

    I got same error, if i'm using SQL Expression, instead of variable expression in filter section.
    make sure that you followed this:
    filter on year > Add > Variable > Presentation. Then, give the presentation variable name (which you defined in dashboard prompt) in Variable Expr field , click OK
    getting same error when using:
    Filter on year column > Add > SQL Expression > presentation variable. This is not right place to give presentation variable.
    and, error i got:
    *State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27005]* Unresolved column: "var_Year". (HY000)
    so, make sure that you are suing the right one..

  • OBIEE 11g:  Use presentation variable in Column Heading

    Hi everyone,
    I was playing around with sample app dashboards and I saw a dashboard prompt that they converted into a column selector. I liked it and reproduced it in my own sandbox.
    I like the results, however, I would also like to change the column heading to clearly reflect which measure was selected. It's pretty clear when you are looking in the dashboard, but once you export the data, it can be confusing which measure was selected.
    That is why I would like to use a presentation variable in the column heading section. I tried to do this but it interpreted it as a literal instead of evaluating the statement.
    Is there anyway to get a variable in the column heading?
    Thanks!
    -Joe

    Hi,
    Have a look at the following links:
    http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/
    show the presentation variable on table column header
    Define presentation variable in column header
    hope it helps.
    Regards,
    Kalyan Chukkapalli
    http://123obi.com

  • Issue in using presentation variable as filter condition in the reports

    Hi,
    I have an issue in using presentation variable as filter condition in my reports the details are as follows:
    Details :
    We want to implement the Max and Min variables through Presentation variables only.we do not want to implement it through session variables in this case.
    We have two variables MIN and MAX to be used as Presentation Variables,for a column of the report (which is a quantity),so that the user wants to see the data for this column within a particular range.i.e the Min and the Max.This part has been implemented well . The issue is when the user wants to see the full data.In that case we will not pass any values to these two Presentation Variable or in other words we are not restricting the report data so we are not passing any value to the variables,this is when the report is throwing the error. we want to leave this variables blank in that case.but this is giving error.
    Please suggest how can I overcome this issue.
    Thanks in Advance.
    Regards,
    Praveen

    i think you have to use guided navigation for this. create two reports first is the one you are having currently and second is the one in which remove the presentation variable from the column formula. i.e. the same report with no aggregation applied.
    Now create a dummy report and make it return value only when the presentation variable value is not equal to max or min. guide the report to navigate between the first and second report based on the result of the dummy report.

  • Help to use presentation variables in title view

    Hi,
    I am trying to use presentation variables in title view and the presntation variable that I have created is for current month date range (04/01/2012-04/30/2012)
    When I am using this variable in the title view in the report it is showing me as (04/01/2012,04/30/2012)
    IS there any way to get the date range as 04/01/2012-04/30/2012 instead of comma

    863997 wrote:
    Hi,
    I can not create two presenation variables and use becasue I have dashboard prompts setted up and I am using that prompt in my dashboard and report to..So if I create two presentation variables seaperately and use then whenever we change the dates in the prompts the dates in the reprot title will not changeYou absolutely can use two presentation variables and they will change in the Title View if you use them there. Click on this link for the details on how to create the two prompts and use them in your report.
    http://oraclebizint.wordpress.com/2008/02/26/oracle-bi-ee-101332-between-prompts-for-date-columns-using-presentation-variables/

  • How to set MULTIPLE repository variables using presentation variables

    Hi,
    I need to pass multiple values from presentation variable to repository.
    A brief about report design :
    I have two repository variables - from_dt and to_dt which are defaulted to some values from a database table and are editable by the user.
    I display these default date values on the dashboard. Plus there are two dashboard date prompts allowing user to enter a date range different from what is displayed by the from_dt and to_dt. The dates entered by user are assigned to presentation variables pv_from_dt and pv_to_dt.
    If user specifies a different date range then these date values are to be passed to a stored procedure which is called from the Connection Pool --> Connection Script Tab --> Execute before query. This procedure will do some calculations and populate a global temporary table before running the report.
    Problem :
    Now in the presentation server, in the Advanced tab, in the Prefix section, when i try to write something like this:
    SET VARIABLE from_dt = '@{pv_from_dt}';
    SET VARIABLE to_dt = '@{pv_to_dt}';
    I get the foll error :-
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <SET>: Syntax error [nQSError: 26012] . (HY000)
    I tried all possible permutations and combinations
    SET VARIABLE from_dt = '@{pv_from_dt}',SET VARIABLE to_dt = '@{pv_to_dt}'; --- gave same error
    SET VARIABLE from_dt = '@{pv_from_dt}' SET VARIABLE to_dt = '@{pv_to_dt}'; -- gave same error
    How do we assign values to multiple reporsitory variables... ???
    Thanks
    Nusrat

    Hi,
    I wrongly referred to the variables as "repository" variables. Both variables are Session variables. For testing i added a column field in the report with source as the session variable - VALUEOF(NQ_SESSION.from_dt). In the Prefix section i assigned a literal value - SET VARIABLE from_dt='01-JAN-2012';
    When report is run, the literal value gets displayed.
    The idea to update a session variable, from dashboard using presentation variable, i got from the following URL.
    Go to http://oraclebizint.wordpress.com/category/obi-ee-plus/page/11/
    and see the section "Oracle BI EE 10.1.3.3/2 – Updating Session Variables from Dashboards using Presentation Variables"
    Thanks
    Nusrat
    Edited by: user10309945 on Jan 16, 2011 9:30 PM
    Edited by: user10309945 on Jan 16, 2011 9:59 PM

  • Using Presentation variables..along with case statements..

    Hi All.
    I have a issue using presentation variable along with CASE statements. My approach is
    1) I have a dashboard prompt, which is being set as Presentation variable.
    Based on the value selected in prompt, for ex the values of prompt can be 'ABC' and 'DEF'.
    I have a calculated column, the calculation goes this way...
    The forumal is
    CASE WHEN @{Presentation Variable Name} = 'ABC' THEN xxxxxxxxxx ELSE IF @{Presentation Variable Name} = 'DEF' END. It gives error of "no table being referenced"..
    Is this is the right approach??
    Can i get the values of variable in a column formula, so that a column can have values selected in prompt?
    Can anybody pls help me here..
    Thanks in advance...

    Hi
    Thanks for the quick response..
    I agree to ur point..
    But the requirement is
    Based on the value of the prompt I need to switch the calculation in one of the formula area of one column..
    If Prompt value is ABC then one kind of calculation in Fx and If the prompt value is DEF then one kind of calculation in the same Fx..
    How can I acheive this?
    Thanks in advance..

  • How to pass the values to stored proc using presentation variable in OBIEE

    Need your help regarding in resolving an issue in OBIEE 10.1.3.4.1
    There are 6 reports say ‘A’,’B’,’C’,’D’,’E’,’F’ in the same subject area.
    The reports are being configured with prompts using either the repository/presentation variables.
    One of the reports say ‘A’ has been configured to pass the values using presentation variables from the prompt in Advanced Tab of the report request to the stored procedure defined in the Execute Before Query section of the connection pool.
    After running another report ‘B’ in the same subject area, upon visiting the report ‘A’ view display error is being seen ( Please have a look below screen shot for your reference) .
    Speculate the issue is around presentation variables of report ‘A’ getting initialized even before running the report.
    Appreciate your earliest advise as this is a prod issue.

    Hi Prasad,
    I got your note, you should not use Session variable syntax to call presentation variable.
    you should use like @{AIC_PROJ_PLAT_SEQ_NO}
    One more thing: first test the variable AIC_PROJ_PLAT_SEQ_NO value then try to pass to SP.
    Hope this helps

  • Unable to pass the values to stored proc using presentation variable in OBI

    Hi All,
    Need your help regarding in resolving an issue in OBIEE 10.1.3.4.1
    There is an OBIEE requirement whereby two prompts need to be defined.
    1.     Textbox prompt
    2.     Drop-down prompt
    The dropdown values should be populated using textbox prompt. So, we have used presentation variable in textbox prompt and passing the same to select query of drop-down.
    Until this step, the report works just fine.
    Now, the value in both textbox and drop-down needs to be passed to stored proc.
    While trying to pass the values by using the presentation variable, the following error comes-up saying
    Session variable has no value definition.
    Note:Although the corresponding session variable has been set to default value,still the error appears.
    Please advise.
    Regards,
    Prasad

    "Session variable has no value definition" I'm assuming typo error and it should be presentation variable.
    Set default value for presentation variable that may work

  • Using presentation variables in report columns

    Hi.
    I need to create a report column evaluating the difference in days between a field containing a date and a presentation variable.
    My field is defined as:
    TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", @{DataAnalisiScaduto})
    Where DataAnalisiScaduto is a presentation variable passed to the report and it's generated on a date field.
    Executing the report I get an error and looking at the session manager in the generated query I can see:
    TRUNC( (31 / nullif( 12, 0)) / nullif( 2010, 0) ) - TRUNC( T4292.DATA )
    Why ? How can I do ?
    Thanks,
    Andrea

    Erro again ...
    the value passed is 03/02/2011 (picked from the calendar) and the default suggested is 2010-01-10
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 46047] Datetime value 03/02/2011 from 03/02/2011 does not match the specified format. (HY000)
    SQL Issued: {call NQSGetQueryColumnInfo('SELECT "Data Incasso"."Data Incasso", "Data Scadenza"."Data Scadenza Fattura", "Dettagli Pagamento"."Cd Fattura", "Dettagli Pagamento"."Cd Tipo Riga Pag", CASE WHEN TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date ''03/02/2011'') <= 0 THEN ''Fino 0 gg'' WHEN TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date ''03/02/2011'') > 0 And TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date ''03/02/2011'') <= 30 THEN ''Fino 30 gg'' WHEN TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date ''03/02/2011'') > 30 And TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date ''03/02/2011'') <= 60 THEN ''Fino 60 gg'' WHEN TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date ''03/02/2011'') > 60 And TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date ''03/02/2011'') <= 90 THEN ''Fino 90 gg'' ELSE ''Oltre 90 gg'' END, Misure.Dovuto, Misure.Pagato, Misure.Scoperto FROM "Vendita - Pagamenti"')}
    SQL Issued: SELECT "Data Incasso"."Data Incasso", "Data Scadenza"."Data Scadenza Fattura", "Dettagli Pagamento"."Cd Fattura", "Dettagli Pagamento"."Cd Tipo Riga Pag", CASE WHEN TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date '03/02/2011') <= 0 THEN 'Fino 0 gg' WHEN TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date '03/02/2011') > 0 And TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date '03/02/2011') <= 30 THEN 'Fino 30 gg' WHEN TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date '03/02/2011') > 30 And TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date '03/02/2011') <= 60 THEN 'Fino 60 gg' WHEN TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date '03/02/2011') > 60 And TIMESTAMPDIFF(SQL_TSI_DAY, "Data Scadenza"."Data Scadenza Fattura", date '03/02/2011') <= 90 THEN 'Fino 90 gg' ELSE 'Oltre 90 gg' END, Misure.Dovuto, Misure.Pagato, Misure.Scoperto FROM "Vendita - Pagamenti"

  • Error using presentation variable in SQL Expression

    Hi all,
    I'm receiving an error - '...Error getting drill information...' due to a presentation variable being used in a SQL Expression. It probably has something to do with a data type issue. I've narrowed the error to the use of the presentation variable.
    I'm setting a presentation variable, pres_mth_nme_to, from a dashboard prompt. The prompt contains a month name.
    I'm using the presentation variable as part of a SQL Expression in a filter. The gist of the SQL Expression is to use the
    presentation variable in a CASE and set a value accordingly. For example:
    Column: Month Sort Value
    Operator: Between
    Value: *10*
    SQL Expression: *Case  @{pres_mth_nme_to}{some default} WHEN 'NOV' THEN '10' WHEN 'DEC' THEN '11' WHEN 'JAN' THEN '12' WHEN 'FEB' THEN '13' WHEN...END*
    The month name is character. If I were to hard code this, I don't recieve the error. For example:
    CASE 'SEP' WHEN 'NOV' THEN '10' WHEN 'DEC' ...END
    There something going on with the data type from the prompt and it being used in the comparison. If I use a CAST, the problem still exists.
    CASE CAST(@{pres_mth_nme_to} as char(3)) WHEN 'NOV' THEN ... END
    If I'm in Answers, the problem doesn't exist, I'm assuming because of the default values. If I'm on the dashboard, it does exist, I'm assuming because of recieving the prompt value.
    I don't know what I'm missing. Any suggestions?
    Thanks.

    DJ,
    if the formula presented by you is exactly true, i mean it was not fabricated to present as an example in the forum, you should include the presentation variable in single quotes.
    i.e. your formula must look somthing like
    Case '@{pres_mth_nme_to}{some default}' WHEN 'NOV' THEN '10' WHEN 'DEC' THEN '11' WHEN 'JAN' THEN '12' WHEN 'FEB' THEN '13' WHEN...END
    let me know if it did solve the issue...
    -bifacts
    http://www.obinotes.com
    Edited by: bifacts on Oct 25, 2010 1:50 PM

  • Show the period value in column header using Text Variable

    We are using Posting Period & Financial Year to calculate YTD & MTD, for current year and previous years. These posting period and financial year characteristics are custom created characteristics we are using due to customer specific requirement.
    Input values are posting period, financial year and numeric value. To calculate previous year, I need to subtract numeric value from the input financial year. Every thing is working fine up to this.
    In the report I need to show the posting period and financial year values dynamically in each column header of the report for MTD, YTD for current year & previous year. I tried to achieve this using Text Variables, but I didn’t succeed. If some one can give me some idea to resolve this, it would be very helpful.
    I am excellent in ABAP coding. If you can specify me to code in User Exit, I can do it.
    Column headers should be 08.1999 Sales Qty, 08.2008 Sales Qty, 1999 Sales Qty, 2008 Sales Qty.

    Hi Abhinav,
    Try using the content text variables 0T_FYEAR and 0T_FPER3, when used in the head these variable should display the year and period specified in the RKF.
    e.g
    &0T_FPER3&. &0T_FYEAR& Sales Qty = 08.1999 Sales Qty
    If that doesnt work, try creating text replacement path variables referencing the variables you created for the year and period input. To do this click on the RKF and click on the dropdown by the yellow box next to the description on the general tab and select New Variable, enter the description, tech name and set processng by to Replacment Path, then select period as the ref. characteristic, then on the replacement path tab change replace variable with to variable and then select the variable you are using for the period input, save then hit ok, this is now a text representation of the variable your are inputing for period and can be used in the column headers, you will need to repeat the process for the fiscal year.
    Hope this helps
    Josh

  • Using presentation variables selected in dashboard prompt in query builder

    In dashboard prompt I have made four dropdowns(have four presentation variables) and based on these values selected,can the Query Builder generate dynamic reports based on the presentation variables selected?
    I will provide the link(i.e Link of BI publisher where I stored the report) displayed to the user based on Four presentation variables.
    If we click on that link can we use the presentation variables in where clause of Query Builder in BI Publisher?
    Please help me out
    Thanks in Advance

    - OK. In the second prompt, instead of setting Default to SQL Results, set it to Specific Value.
    - Then insert '{pres_var}' in the window. I got it to work this way.
    - It supplied the PV as the default in the second prompt after hitting "Go" on the first prompt.
    Hi, thanks for your suggestion but I don't need to have the value of the presentation variable itself as the prompt default. The variable is a filter for a specific SQL clause and the default is the result of this SQL.
    Cheers
    DrPlexi

  • Hide entire column based on presentation variable?

    Has anyone ever tried to do this? If user selects all records from prompt i want to display analysts assigned to those records. If user selects specific analyst i don't want to display analyst column. I know i can null out or show analyst based on presentation variable but what about hide entire column?
    If this is not possible has anyone tried to use conditional formatting to hide entire column?

    Try this:
    0) Create a dashboard prompt on "analysts" and check the "All Choices" checkbox. Set the prompt to a presentation variable.
    1) Create a small report with two columns, one column will be your analyst column, the other will be a column which houses MAX(RCOUNT(1)) in the Edit Column formula window (what you get when you press the fx button). Put another filter on the analyst column set to the presentation variable with one of the analysts as the default.
    2) Put a filter on the the MAX(RCOUNT(1)) column "greater than 1"
    3) Create two copies of your actual report, one which has the analyst column, one without.
    4) Now in your dashboard you will need three sections, one for your prompt, one for the "with column" report and one for the "without column" report.
    5) In the Section Properties of the "with column" report, click on "Guided Navigation" and navigate to the small report you created in step one. Set this section to display "if request returns rows." Don't forget the filter on this report set to the presentation variable.
    6) In the Section Properties of the "without column" report, click on "Guided Navigation" and navigate to the small report you created in step one. Set this section to display "if request returns nothing." This report will not need a filter on the analyst prompt, because by definition it will display all analysts.
    Now when "all choices" is selected on the prompt, the second report displays in the dashboard, and when a single analyst is selected, then the first report will display with the analyst column.

  • Using presentation variable in multiselect control

    Hi All,
    I have a requirement.
    I'm showing a dashboard page which contains a Direct SQL request and a prompt. The prompt needs to be a multiselect control.
    The SQL request is as follows:
    Select user_name, user_id from table_name where user_id = @{presentation_variable}.
    The presentation variable will be declared in the prompts, which I can use it in the sql request.
    But when we select multiselect control, it doesn't show the box where we can declare a presentation variable.
    It allows us to declare presentation variable when we select drop dwon control, in which only one value is selected.
    Can anyone guide me how I can use multiselect with Direct SQL request, so multiple values can be passed to filter the results.
    Thanks.

    hi rgksugan,
    Presentation variable will not hold more than one value,so we can't set presentation variable(set variable) to multi select
    how I can use multiselect with Direct SQL request, you can't do this with multi select
    Thanks,
    saichand.v

Maybe you are looking for

  • Can not view data in Dimension Data Viewer

    Hello Forum, Has anyone run into this one yet? with OWB10gr2 we have created a dimension called store, it has a simple hiearchy" store-->category-->primary category-->Busines Unit The dimension validates and deploys sucessfully - we have seen the not

  • Caller ID won't switch to on

    My caller ID switched itself to off and I can't flick it back to on, everything esle is working is working fine but the button wont move over to on, I reset my settings and the phone but it still wont wor

  • Bug or Design?

    I like the 'landscape mode' that Nike+ goes into when you lock the ipod touch/phone and rest it horizontally. What bugs me is that because it is in lock mode the screen turns off after a few seconds. I wonder if the ability to put the application in

  • My iphoto has a transparent question mark over it and will not open. How do I fix this?

    My iphoto on my imac will not open. It has a transparent question mark over it...how do I fix it?

  • T60 - thinkpad ultranav driver is not detected

    Hello, From the following link I downloaded and installed the "UltraNav Utility for Windows 7 (32-bit, 64-bit), Vista (32-bit, 64-bit), XP (32-bit, 64-bit) - ThinkPad " http://support.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-l