Sorting report columns for PL/SQL report

I have created a report of type "Pl/Sql function body returning Sql query" in which I am generating the column names within the query. I would now like to make the first three of these columns sortable. But when I click on the "sort" box for the first three columns, all my column names suddenly switch to "Col 1", "Col 2" etc.
As you can see by the following snippet from the PL/SQL that generates the query, the column names are data driven, so I'm not in a position to declaratively rename each column. As it happens, the first three columns names are fixed, but all the subsequent column names are data driven.
Suggestions on how to make the first three columns sortable while preserving the generated column names of the remaining columns?
thanks
susan weber
declare
query varchar2(4000); -- query
begin
query := 'select first_name "First Name", last_name "Last Name", encounter_date "Encounter Date" ';
for c1 in (select distinct attr_src, attr_code, attr_text, sequence_number from finding_vt)
loop
query := query || ', (select val_text from finding_vt vt where vt.encounter_id = e.encounter_id and vt.attr_src = ''' || c1.attr_src || ''' and vt.attr_code = ''' || c1.attr_code || ''' and sequence_number = ' || c1.sequence_number || ') "' || substr(c1.attr_text,0,30) || '"';
END LOOP;
query := query || ' from patient pat, encounter e where pat.patient_id = e.patient_id';
return query;
end;

This turns out to be related to the choice of "use generic column names" v. "use query specific column names".
I had chosen "use generic column names" just to get past the initial creation page. I then debugged the query creation sql, but never changed that setting back to "use query specific column names". The fix is to choose "use query specific column names".

Similar Messages

  • Maximum number of columns for a SQL report

    I am trying to pull a single report for approx 180 - 360 columns per row from a table with 30 columns (6 to 12 months data). The report is then to be exported to csv and then merged into a Word document. Due to the limitation of 100 columns in html db this cannot be done.
    We cannot merge direct from the database. Is there another method to get data into Word or out of the database that I have not thought of?

    Hi Arvind,
    You are correct in saying that only 50 columns can be shown in the BW report at a time. It will allow you to place more than 50 fields in the query definition but the query will not execute.
    If you want to show more than 50 columns, you can add those extra columns in the FREE CHARACTERISTICS of the query definition. So at the time of execution of the query user will see the 50 columns by default and if he wants to see those additional columns, he can replace the already existing columns by the fields in the free characteristics. This can be achieved by DRILL DOWN and DRILL ACROSS.
    This is the way to go about it. We also did the same thing in our case.
    Regards,
    Yogesh

  • Reporting Services for Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0

    Hello,
    We are currently running:
    Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0 (Intel X86)   Apr 22 2011 11:57:00   Copyright (c) Microsoft Corporation  Standard Edition on Windows NT 5.2 <X86> (Build 3790: Service Pack 2) (Hypervisor)
    We would like to know what is required to configure Reporting Services for Microsoft SQL Server 2008 R2 Standard.  Is their a cost associated?  I need to inform our IT people what is needed.
    Looking forward to your reply, Linda

    Double post:
    http://social.msdn.microsoft.com/Forums/en-US/3e6c5d4e-228e-4a95-b017-4c20ec61cae4/reporting-services-sql-server-express-2008-r2?forum=sqlreportingservices
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How to use one report column into the another report in obiee

    How to use one report column into the another report in obiee

    i dont want to use column as a filter for another report it should be report column for another report
    Thanks,
    Vivek

  • How to hide/show main report footer for a sub report ?

    Need to hide main report footer for a sub report(having more than one page and need to hide footer for all those pages).And again make it visible for another sub report which also have more than one page (and do the same to all of its pages)
    I have tried with formula
    WhilePrintingRecords;
    Shared BooleanVar SuppressFooter := True;
    WhilePrintingRecords;
    Shared BooleanVar SuppressFooter := False;
    with this formula main report footer is shown only on last page of sub report where i need it in all pages.
    Any solution??

    Hi Jinu,
    1) Do some or all of those subreports span multiple pages?
    2) Do each of the Subreports start on a new page?
    If yes, for both, then here's what you need to do:
    1) Create a formula (@True) with this code:
    shared booleanvar SetStatus:= True
    2) Create another formula (@False) with this code:
    shared booleanvar SetStatus:= False
    Drag and drop the @True formula on the details sections for which you want the Page Footer to be suppressed.
    Similarly, drop the @False formula on the details sections for which you want the Page Footer to show up.
    Then, go to the Section Expert > Select Page Footer c > Click the formula button beside Suppress and use this code:
    shared booleanvar SetStatus;
    -Abhilash

  • Add Image column in classic sql report to open a pop page

    I have sql report I want to add a new column which will have image to click, Once user clicks the image a popup page should open.

    Hi Vikram,
    Sorry to bother you, I am very new to apex. Here is my sql query for sql report. Can you please help me.
    <xmp>select
    case
    when ISUPPORT_NUMBER is null or ISUPPORT_NUMBER = 'N/A' then '<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Enter SR Number</p></a>'
    else '<span style="background-color:red;font-weight:bold">'
    || ISUPPORT_NUMBER
    || '</span>'
    end ISUPPORT_NUMBER,
    case
    when ISUPPORT_NUMBER is not null and ISUPPORT_NUMBER != 'N/A' then '<a href="javascript:myFunc4(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#FF0000;font-size:14px;">'|| MACHINE_NAME ||'</p></a>'
    else '<a href="javascript:myFunc4(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:14px;">'|| MACHINE_NAME ||'</p></a>'
    end MACHINE_NAME,
    FUNCTION,
    VERSION,
    VENDOR_CLUSTER,
    case when used_by is null then '<a href="javascript:myFunc2(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Avaliable</p></a>'
    when upper(used_by)=v('APP_USER') then '<a href="javascript:myFunc5(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:blue;font-size:12px;">' || used_by || '</p></a>'
    else used_by
    end used_by,
    case
    when loaned_to is null and ( upper(used_by)=v('APP_USER') or used_by is null) then '<a href="javascript:myFunc(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Avaliable</p></a>'
    when upper(used_by)=v('APP_USER') then '<a href="javascript:myFunc6(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:blue;font-size:12px;">' || loaned_to || '</p></a>'
    else loaned_to
    end loaned_to,
    LOANED_TO_EXPIRY_DATE,
    LOAN_INFO,
    decode(SCAN_NAME,null,'<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">More Details</p></a>','<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">More Details</p></a>') SCAN_NAME,
    USERNAME,
    VNC_PASSWORD,
    LAST_UPDATED_BY , </xmp>
    <b>Here I want to add a image column where I can give a link like above to open popup </b>
    from install_dbqa_machines
    Edited by: Sivaramaraju on Jun 19, 2012 9:06 AM
    Edited by: Sivaramaraju on Jun 19, 2012 9:07 AM
    Edited by: Sivaramaraju on Jun 19, 2012 9:08 AM

  • Solution to allow users to specify which columns of a sql report to search

    Starting Point:
    1) You have an existing SQL Report.
    2) You want to provide functionality to search through the result set.
    Start -----
    1) add a text_item for searching PX_search where X is page number
    2) add a button which resubmits the page. Go
    3) You modify your query by adding the following to the end of the where clause.
    and (PX_SEARCH is null or instr(column_name1,PX_SEARCH) > 0 )
    4) So far so good but it only allows searches on 1 column, so you add a few other columns
    and (PX_SEARCH is null or instr(column_name1,PX_SEARCH) > 0 or instr(column_name2,PX_SEARCH) > 0 or instr(column_name3,PX_SEARCH) > 0 )
    Now when you enter some text if it is in any of the columns that row will be displayed.
    This can be good or bad depending on your requirement. lets say my users want to specify the column they are searching on.
    5)further enhancement
    i) add a LOV to your page which queries the all_users data dictionary view
    select column_name d, column_name r from all_users where table_name = 'MY_TABLE_NAME' and column_name not in ('COLUMN_NAME1,COLUMN_NAME2) order by column_name
    The idea here is to use the oracle data dictionary to get all the columns for your table(s) and ignore the columns you do not want.
    ii) add an item to your page e.g. PX_select_column which gets populated from the list of values.
    Now for each column you are going to allow a search on, the sql needs to be modified.
    Lets pretend that my firstcolumn is called member_id, my second column is called firstname and my third column is lastname
    Before we had this SQL
    (select * from table where 1=1)
    and (PX_SEARCH is null or instr(memberid,PX_SEARCH) > 0 or instr(firstname,PX_SEARCH) > 0 or instr(lastname,PX_SEARCH) > 0 )
    Remember we have added PX_SELECT_COLUMN which should contain what we have selected from the LOV.
    iii) So now we modify the query to be as follows:
    and (PX_SEARCH is null or decode(:PX_SELECT_COLUMN,'MEMBERID',instr(memberid,PX_SEARCH),0) > 0 or
    decode(:PX_SELECT_COLUMN,'FIRSTNAME',instr(firstname,PX_SEARCH),0) > 0 or
    decode(:PX_SELECT_COLUMN,'LASTNAME',instr(lastname,PX_SEARCH),0) > 0 )
    The user can now choose which column to filter their results on.

    Here is a basic one (http://apex.oracle.com/pls/otn/f?p=2230:1). You can select an object type and put in criteria for the object name like '%b%'. The SELECT statement is dynamically generated with only the pieces of the WHERE clause that are needed. You do not need all the DECODE and INSTR OR logic.
    The main part of this example is the computation of the SQL SELECT statement:
    DECLARE
      v_sql VARCHAR2(2000) := 'SELECT *'||CHR(10)||'  FROM USER_OBJECTS';
      v_and BOOLEAN := FALSE;
      v_where VARCHAR2(2000);
    BEGIN
      -- P1_OBJECT_TYPE has value of 'ALL' for '%'
      IF (:p1_object_type != 'ALL') THEN
        v_sql := v_sql || chr(10) ||
                 ' WHERE object_type = '''||:p1_object_type||'''';
        v_and := TRUE;
      END IF;
      IF (:p1_object_name IS NOT NULL) THEN
        IF (v_and) THEN
          v_sql := v_sql || chr(10) ||
                   '   AND object_name LIKE UPPER('''||:p1_object_name||''')';
        ELSE
          v_sql := v_sql || chr(10) ||
                   ' WHERE object_name LIKE UPPER('''||:p1_object_name||''')';
        END IF;
        v_and := TRUE;
      END IF;
      :p1_sql := v_sql;
      RETURN (v_sql);
    END;Mike

  • CSS to format a textarea column in an SQL report

    I'm using the following CSS class called "fixed" to format a multi-line column (textarea) in a standard SQL report (Column Formatting Attribute: CSS Class). Each row is now hard coded to a height of 40px or about 4 rows with a scrol bar. If the row has no data in it I'd like to default the row to a height of 1. Is it possible to do that?
    <style type="text/css">
    .fixed {display:inline-block; width:150px; height:40px; overflow-y:scroll; font-size:9px;}
    </style>
    regards
    PaulP

    PaulP wrote:
    I'm using the following CSS class called "fixed" to format a multi-line column (textarea) in a standard SQL report (Column Formatting Attribute: CSS Class). Each row is now hard coded to a height of 40px or about 4 rows with a scrol bar. If the row has no data in it I'd like to default the row to a height of 1. Is it possible to do that?
    <style type="text/css">
    .fixed {display:inline-block; width:150px; height:40px; overflow-y:scroll; font-size:9px;}
    </style>Try <tt>max-height:40px</tt> instead.
    For a less speculative response, provide complete information on the environment and any restrictions therein:
    <li>Full APEX version
    <li>Full DB version and edition
    <li>Web server architecture (EPG, OHS or APEX listener)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region type(s)
    and a reproduction of the issue on apex.oracle.com that we can experiment with.
    Is this just to limit the size of an actual report or is the <tt>textarea</tt> editable within a tabular form ? If the former I'd just use a <tt>div</tt>...

  • Sorting the column of VARCHAR in report

    Hi,
    I want to sort the column in report with the following scenario,
    I have a column name with PERIOD as VarChar with values APR-11,FEB-11,JAN-11,JUN-11,MAR-11,MAY-11 in a report
    As you can see, It is sorting in Alphabetic order but I need to arrange in JAN-11,FEB-11,MAR-11,APR-11,MAY-11,JUN-11
    So can anyone has a good work around solution?
    regards
    Vj

    Here is your challenge. How do you get Jan-12 to come after Dec-11? Adil's solution is partial. It works only for the current year. Once you cross over to the next year, it stops working because you are only sorting the month. You must include the year to make the solution complete. So here is a solution that always works. It involves some math so I'll explain the math first.
    Let's look at your values:
    Jan-11
    Feb-11
    Dec-11
    Jan-12
    If you convert each month to a number (i.e., Jan = 1, Feb =2... etc.) and then multiply the year by 1000 and finally add them together, we get this:
    Jan-11 1 --> 11001
    Feb-11 2 --> 11002
    Dec-11 12 --> 11012
    Jan-12 1 --> 12001
    You get the picture. The last column will be in the order you seek because the integer will always be greater than the previous month-year even at the transition from December to January. BTW, I multiplied the two digit year by 1000 to ensure that there would be no overlap.
    Now you can sort by this third column. Here is the code that does this:
    CAST(CASE WHEN LEFT(Table.PERIOD, 3) = 'Jan' THEN '1' WHEN LEFT(Table.PERIOD, 3) = 'Feb' THEN '2' WHEN LEFT(Table.PERIOD, 3) = 'Mar' THEN '3' WHEN LEFT(Table.PERIOD, 3) = 'Apr' THEN '4' WHEN LEFT(Table.PERIOD, 3) = 'May' THEN '5' WHEN LEFT(Table.PERIOD, 3) = 'Jun' THEN '6' WHEN LEFT(Table.PERIOD, 3) = 'Jul' THEN '7' WHEN LEFT(Table.PERIOD, 3) = 'Aug' THEN '8' WHEN LEFT(Table.PERIOD, 3) = 'Sep' THEN '9' WHEN LEFT(Table.PERIOD, 3) = 'Oct' THEN '10' WHEN LEFT(Table.PERIOD, 3) = 'Nov' THEN '11' WHEN LEFT(Table.PERIOD, 3) = 'Dec' THEN '12' END AS INTEGER)+CAST(RIGHT(Table.PERIOD, 2) AS INTEGER)*1000
    This solves your problem now even when the month-year crosses to the next year. There you go!

  • Download column link to SQL report

    Hi ,
    I am using apex 4.1.
    I have a SQL report  with blob image column also . And along with the image i need to add download link as a column can some one please suggest me how to do it.
    Thanks
    Raghav

    raghav1212 wrote:
    I am using apex 4.1.
    I have a SQL report  with blob image column also . And along with the image i need to add download link as a column can some one please suggest me how to do it.
    This is very simple. Reference the image column twice in the report query projection, and apply a download format mask to one column and an image mask to the other.

  • Heading and color scheme of the columns for the detail report

    Is it possible to have a heading and color scheme of the columns for the reports displayed on drill down of a query in WAD?

    Try the stylesheet in the properties of web template.

  • Getting Column names from SQL report

    I have a SQL report as follows:
    select ename, dept, manager
    from emp;
    I need to be able to dynamically access the column names being displayed inside APEX so I can use in a List of Values. I can't use all_tab_columns. Is there an internal APEX table/view that I can accxess that will give me all of the columns that are eing displayed in a SQL report?

    Hi Bob,
    Try this -
    1) Give your report region a static id
    2) Use the following query -
    select
      heading d,
      column_alias r
    from
      apex_application_page_rpt_cols
    where region_id = 'FOO';Obviously change 'FOO' to match your region id, and look at the different columns available in the apex_application_page_rpt_cols view to see what best suits you.
    The APEX dictionary rocks ;)
    Hope this helps,
    John.
    http://jes.blogs.shellprompt.net
    http://apex-evangelists.com

  • How to show the break totals and NOT the report totals in an SQL report

    APEX 4.0.1
    In an normal SQL report (Not interactive) with a break applied on the first column, how do you just show the break totals and NOT the extra full report totals?
    Next, Is it possible to display only some of the row totals and not for all columns that have the sum option checked against them?
    PaulP

    PaulP wrote:
    APEX 4.0.1
    In an normal SQL report (Not interactive) with a break applied on the first column, how do you just show the break totals and NOT the extra full report totals?Instead of using the APEX break feature, try doing all of this in the query using <tt>GROUPING SETS</tt> or <tt>ROLLUP</tt> to get the break rows, and <tt>GROUPING_ID</tt> in the <tt>HAVING</tt> clause to suppress the unwanted rows.
    Next, Is it possible to display only some of the row totals and not for all columns that have the sum option checked against them?Don't really understand what's meant here?

  • Lines Between Report Columns in Purchase Order Report

    Hello All,
    I am working with the Oracle Purchasing Report called POXPRPOP.rdf. I am trying to add a black frame between each column in the report. Imagine in a purchase order where several columns of data that have a black line in between them. I have tried working with the expanding frame around the data fields of the report, changing the line color of these expanding frames to black. This didn’t work to give me lines in between the columns. I have been able to bring other graphical elements into the report so it is not a graphics problem at the UNIX environment.
    I am using Reports 6i and Running the report through Oracle Applications Concurrent manager.
    Thanks for any help,
    Bradley

    It seems like I might be able to put a line between the data fields and set it to expand with the repeating frame. Maybe this is this how it is done.
    Bradley

  • Crystal report 2008 for B1 Join report of open PO, good receipt, good retur

    Hi All,
    I am new to crystal report for B1. I am developing a report for showing all open purchase order, good receipt, good return, A/P Invoice and A/P credited memo   rows for selected project.
    This is similar to open item report, but I need to show detail rows (items) for each of those Document. I can easy do a select token with project code for only one type of those document e.g. open purchase order (link OPOR with POR1 and select records by project code).
    My question is how to do a report with those 5 types document together. I did try to include all those tables, but I canu2019t find a link between them.  Or Can I do something link sub reports to include all those report by using one selection token?  How can I do it?
    Any comment, ANTHING will be very much appreciated!!

    Hi Julian......
    yes you are correct use OLE DB connection and when it shows your PC Connection then just put the necessary information related to SQL server and DB for which you want to create this query.
    Once you put all these info then click on next and then finish.
    It will show you the Command option and one more option in expand and collapse format where all the tables and views of database are present.
    Just double click on command and paste your query report and add it......
    Now its set to design CR for your query as per requirement.....
    Regards,
    Rahul

Maybe you are looking for

  • How can I to repair this Index corruption??

    Hi. I´m working with Oracle 9.2.0.7.0 on Windows 2003 SP2. I´ve a corruption issue on a PK index that I not am able to repair... I´ve detected it when I tried make a RMAN backup.This is the message: RMAN-03009: failure of backup command on ORA_DISK_1

  • Itunes stops working for windows 7 64bit

    Hello, As the title says, I am using Windows 7 Professional x64 on my home computer. I am trying to run itunes but it always says "iTunes has stopped working". if necessary, i will upload a screenshot of it but that's all the information I get. it oc

  • Error when launching Firefox

    Hi; I'm experiencing a problem when launching Firefox . Receive the following message; Firefox can't establish a connection to the server at en-gb.start3.mozilla.com I've removed and reloaded Firefox, but same problem. The only thing I can think of t

  • Problem in count

    Hi All, I have problem in count . Example: I have values in internal table like this: No of Traller ,   |         No of  Pallets ,   |       Deliveries,   |--|-- ABC               |                 00987         |         0000302 ABC           |     

  • What information is stored on the sim on an iphone 4S?

    what information is stored on the sim on an iphone 4S?