Modify Template to show columns like a SQL report

Hi All,
Really urgent. We have a procedure and we are using a pl/sql block to get the query. The layout is not nice so they want me to look at the template and change it so the result look like a sql query.
Thanks.

Hi,
OK - if you are using the htp package to output the entire report, then firstly you should have a look at: [http://download.oracle.com/docs/cd/B14099_19/web.1012/b15896/pshtp.htm]. You will see that you have many more options than htp.p or htp.prn - there are htp.tableOpen, htp.tableRowOpen, htp.tableHeader and htp.tableData options for example. Using these, you can add in table/row/cell attributes that will include the styling that you need to get your report to display as you need.
The best thing to do would be to look at the defintion of a report template that matches the style you need and then make a note of the attributes that are used for the TABLE, TR, TH and TD tags.
For example, on my Theme 18, "Standard" report template, the Column Template 1 setting (which is for the data within the table) is:
<td #ALIGNMENT# headers="#COLUMN_HEADER#" class="t18data">#COLUMN_VALUE#</td>so, in your code, when you want to output the data, you can use:
htp.tableData(columnname, 'LEFT', null, null, null, null, 'headers="' || columnname || '" class="t18data"');Anything on the report template that does not have a corresponding parameter in the htp function, needs to be added into the final parameter - in the above example, the headers and class attributes do not match parameters in the htp.tableData() function, so become a single string in the final parameter.
You just need to identify the attributes you need for each TABLE, TR, TH and TD tag and construct them in a similar way in your output.
Andy

Similar Messages

  • 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>...

  • 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

  • Show Image in an SQL Report Region

    Hi,
    I'm having some trouble with showing an image in an sql report region.
    I used the Upload/Download Tutorial in the HTMLDB How-Tos and it worked well.
    Now, I have the following in the query region:
    select s.facilityid, s.id, s.name, s.subject,
    '<img src="#OWNER#.download_my_file?p_file=s.id" width="90" height="70">' image
    from file_subjects s
    where s.facilityid = :FACILITYID
    I get a red X in place of the picture. I know that the pictures are there and have been uploaded successfully. Can anybody tell what I am doing wrong?
    Thanks much,
    Nora

    Nevermind, I fixed it by changing the image line to
    '<img src="#OWNER#.download_my_file?p_file=' || s.id || '" width="90" height="70">' image
    Thanks
    Nora

  • 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.

  • 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

  • Show hyperlink in a sql report

    All,
    How do you show a link in a SQL PLus report ? I want to add a link to one column.
    Got a suggestion saying to do,
    SQL> select 'oracle' from dual;
    When I do this and spool it to a file, the column gets big because the source code shows everything from <a to </a>
    How can I achieve this ?
    Thanks

    I get rows will be truncated messages up alsoYou are getting SQL*Plus error messages at the time of the spool? So, this has nothing to do with how browser is rendering the HTML table. Most of the browsers will resize the html table based on the display width available to the browser window. Resizing the browser window widht will automatically resize the html table columns width. While printing it should be able to resize the html table so as to fit on your paper size (as much as it can).
    As for the errors while spooling, you need to check your SQL*Plus settings like LINESIZE.
    Please post the cut-n-paste of the SQL*Plus session where you give your markup command and the spool command followed by any warnings/errors displayed by SQL*Plus.
    but actually if you see the source, it displays everything starting from , and hence the column becomes too wideWhy would you be loading the html source into an editor outside of the browser to look at it? It obviously contain that markup tags that tell the browser what the link is and what URL it referes to when clicked. That obviously will take some space on the html source since it is just plain markup information for the browser to be able to render the page correctly.
    If the page appears correctly on browser window, if it resizes with the browser window, if it prints correctly, you are fine.
    Did you try any of these? what is the actual issue? does the report not print correctly when printed from the browser print page support?
    Message was edited by:
    Kamal Kishore

  • 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".

  • How to suppress column names in SQL-report

    What I want is just the data, without any column names.
    COLUMN LDATE OFF;
    SELECT     SYSDATE LDATE
    FROM DUAL;
    LDATE
    07.11.11
    This example doesn't work. There is still LDATE above column. Any idea?

    user5116754 wrote:
    Great, it's so simple. Im sure there is a way to omit this result statement: "531 rows selected" at the end of report!There is, and it's also in the documentation...
    SQL> set feedback off
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    SQL>

  • How to create alternate color columns in MS SQL reporting services (rdl)

    I found something related to row coloring at ::
    http://weblogs.sqlteam.com/joew/archive/2008/08/20/60691.aspx
    i went through all the properties for column but none that would help me achive me goal.
    SO in my case .. the no of rows are fixed .. but columns vary .. so i wnat the alternate columns to be of different color (say white and silver)

    Hi,
    Once my no of data sets (mine is 3 columns per data set) changes, the highlighting 'shifted' like below. Any idea how this happen?

  • 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

  • Breaking report layout by column grouping in sql report

    Hello All,
    I have a strange requirement where I have a query which needs to o/p data in the following manner:
    Status Exp. Type Class Entered By Expenditure Group Control Total Running Total
    Submitted Miscellaneous XXXX, Mrs. YYYYY DESAF130501-001 0 .00
    Transaction
    AAAA, Mrs. BBBBBB DEAMK070509-07 77.05 77.05
    CCCCC, Mr. DDDDDDDD B9MM080509-06 0 .00
    B9MM070509-04 0 .00
    B9MM110509-01 0 .00
    B9MM080509-03 0 .00
    B9MM070509-05 0 .00
    B9MM080509-07 0 .00
    B9MM080509-04 0 .00
    B9MM080509-01 0 .00
    B9MM130509-01 0 .00
    B9MM070509-03 0 .00
    B9MM080509-02 0 .00
    B9MM110509-02 0 .00
    B9MM070509-07 0 .00
    B9MM110509-04 0 .00
    B9MM070509-02 0 .00
    B9MM070509-01 0 .00
    B9MM120509-01 0 .00
    B9MM110509-03 0 .00
    FFFFF, Miss WWWW DEARM110509-01 0 142.78
    GGGGG, Mr. HHH ALPM080509-1 0 .00
    LLLLL, Mrs. KKKKKKK JKDTest070709-1 20 20.00
    Total for Expenditure Type Class: 23 97.05 239.83
    So basically the sql query groups by status,exp type class,enteredby,expenditure group.My problem is the user does not want the column values to be repeated for every record inside the group.For Eg: if you see under the group by the entered by : CCCCC, Mr. DDDDDDDD
    The value CCCCC, Mr. DDDDDDDD is displayed only once for the group even though there are more than several records under the group(due to unique records in expenditure group).
    It is pretty straight forward to do in Oracle Reports or in SQL* Plus using Columns BREAK,but iam struggling to do the same thing in plain sql...Any suggestions?

    Oh .Got you..thanks..This is the o/p i require...
         Status             Exp. Type Class      Entered By                Expenditure Group            Control Total     Running Total
         Submitted          Miscellaneous        XXXX, Mrs. YYYYY          DESAF130501-001                          0               .00
                            Transaction
                                                 AAAA, Mrs. BBBBBB         DEAMK070509-07                       77.05             77.05
                                                 CCCCC, Mr. DDDDDDDD       B9MM080509-06                            0               .00
                                                                           B9MM070509-04                            0               .00
                                                                           B9MM110509-01                            0               .00
                                                                           B9MM080509-03                            0               .00
                                                                           B9MM070509-05                            0               .00
                                                                           B9MM080509-07                            0               .00
                                                                           B9MM080509-04                            0               .00
                                                                           B9MM080509-01                            0               .00
                                                                           B9MM130509-01                            0               .00
                                                                           B9MM070509-03                            0               .00
                                                                           B9MM080509-02                            0               .00
                                                                           B9MM110509-02                            0               .00
                                                                           B9MM070509-07                            0               .00
                                                                           B9MM110509-04                            0               .00
                                                                           B9MM070509-02                            0               .00
                                                                           B9MM070509-01                            0               .00
                                                                           B9MM120509-01                            0               .00
                                                                           B9MM110509-03                            0               .00
                                                 FFFFF, Miss WWWW          DEARM110509-01                           0            142.78
                                                 GGGGG, Mr. HHH            ALPM080509-1                             0               .00
                                                 LLLLL, Mrs. KKKKKKK       JKDTest070709-1                         20             20.00
                            Total for Expenditure Type Class:              23                                   97.05            239.83

  • SQL Report--NEED to display HYPERLINK

    Hi. I need to display a hyperlink for one of the columns in a SQL Report. Here are my columns url, name, type.
    I want the name column to be hyperlinks to the corresponding entry in the url column.
    Here's the sql that I was trying to get to work based on what someone else helped me with:
    select type, ''&#0124; &#0124;name&#0124; &#0124;''web
    from interop.links
    Here is the results when I run the report:
    <#''.LABEL#>
    <#''.FIELD#>
    <#''.FIELD#>
    <#''.FIELD#>
    <#''.FIELD#>
    <#''.FIELD#> ...etc, etc.
    Does anyone have suggestions for what I am doing wrong or another solution? I really need to figure out how to do this. Thanks!
    Michelle
    null

    Hi,
    Here is what I understand from your question.
    You have 3 columns
    URL
    NAME
    TYPE
    Say you have url=> www[dot]oracle[dot]com
    name=>Uncle Larry is always right
    you want name to have a href which points to
    the value in column url
    so you need
    select url as the_url,''&#0124; &#0124;name&#0124; &#0124;'' as the_name,type from the table
    null

  • How to set up a column link to the column attribute in a report

    Hi All
    I have 6 column in a sql report in a page, column names are (Devicename devicerole,from etc).
    Now i need to set a link to this column and this need to link to the another page
    Thanks & Regards
    Srikkanth.M
    Edited by: Srikkanth.M on Apr 6, 2011 6:17 PM

    Hi
    Read this and follow it...
    >
    Go to the report attributes, then click on the edit link button by the side of the column you want to be a link to get to the column attributes.
    >
    So...
    1. Go to edit the page that contains your report.
    2. Click on the report region as if you were going to edit the report query.
    3. Click the Report Attributes tab.
    4. Click the button at the side of the column in question.
    5. Scroll down to the Column Link section and fill in the details.
    I really can't put it much more simply than that...
    Cheers
    Ben

Maybe you are looking for

  • MPEG or AVI in PPro CS4 - which is better to work with?

    Back when I was using older versions of Premiere Pro, I was forcefully told by people here on the Adobe forums that I should avoid doing any editing work in MPEG format.  The emphatically-worded advice was that I should do everything in AVI within Pr

  • Log-File to analyze problem with crash/bluescreen

    Hi, im new - not only here also in my current job. I have got a test-sqz, which crashes after a few rounds. The test has to be finished 330 times, it only works 10...40 times (without errors), then crashes windows and get a bluescreen. I want to log

  • My screen keeps freezing  , any suggestions

    my screec keeps freezing , any suggestions .

  • WebService response charset problems

    Some time ago I posted a problem regarding unicode characters in WebService responses from WL7.0. I received a patch that helped partially - after the patch was applied, WL no longer threw any exception when an utf character was included in the respo

  • Disable ALV toolbar

    Hi, I have to disable the toolbar displayed with ALV.I have to disable only few options,like the print command,copy,paste button etc.Please help me in this query. Thanks