Report: display column

Hi, I'm newbie, so I need help. I have SQL query report, which always return just one row.
SQL query: SELECT user_id,first_name,last_name,active FROM my_accounts
where user_id=:P5_user_id
Now, if value of field active is 1, then don't display column active, in other case, display column with value 0 (no active).
Please give me working example.
Thanks
Igor
PS: Sorry on my broken English

I figured one way to accomplish this. Of course there may other ways as well. Basically what you have is one query for ACTIVE values of "0" and another query for ACTIVE values not equal to "0". Do the following to accomplish it:
1.) Change your query to be of type "SQL QUERY (Pl/Sql Function Body Returning Sql Query)".
2.) Under the Region Source click "Use Generic Column Names (parse query at runtime only)"
3.) Define your Region Source to be:
DECLARE
v_sql1 VARCHAR2(2000):= 'SELECT user_id,first_name,last_name, active '||
' FROM my_accounts '||
' WHERE user_id=:P5_user_id';
v_sql2 VARCHAR2(2000):= 'SELECT user_id,first_name,last_name '||
' FROM my_accounts '||
' WHERE user_id=:P5_user_id';
v_sql VARCHAR2(2000);
BEGIN
FOR rec IN (SELECT active
FROM my_accounts
WHERE user_id=:P5_user_id) LOOP
IF (rec.active = 0) THEN
v_sql := v_sql1;
ELSE
v_sql := v_sql2;
END IF;
END LOOP;
RETURN (v_sql);
END;
I hope that helps,
Mike

Similar Messages

  • ALV Report - displaying column name in two fields.

    Dear All,
                 I am working on ALV report , report is ready but now i have to format it according to client requirment, in which have to show column name in two row like.
    supppose there is field by name
    "Date of receipt of processed Goods"
    can i display it like
    "Date of receipt of
    processed Goods "
    Assured points for suitable answer.
    Looking foward to your response.
    Best Regards,
    Gulrez Alam

    Hi Ellery,
    As Philipp said, there is no need for populating the field using PL/SQL. You would just need to go to the Paper Layout in the Reports Editor, click on "Text" in the Drawing toolbar, drag it to the appropriate place in your layout to create the field, and write what you want in that field. Below that, you can create the field(s) which will display the actual totals. I'm assuming that creating the totals field is not a problem.
    Navneet.

  • PowerDesigner 16.5 SP02 HTML Report Display Column Comments

    Hi All,
    I am using PowerDesigner 16.5 SP02 and am trying to view the column comments in an HTML Report. I know that you can enable Table comments and such in the report wizard but I can't find anything on columns. Any help is much appreciated.
    - Eric

    @ Stefan,
    Thanks for your reply. RMB = Right Mouse Button? That's a new one for me.
    I wasn't able to find "Table – List of Table Columns" but I expanded "Table" in "report layout" and then selected "column" and sequentially, "comments".
    In the HTML report I am able to click a diagram and the column comments are shown in a list.
    Is there anyway to have the column comments display within the diagram? This is wishful thinking rather.
    Thanks again.
    - Eric

  • The number of display columns in the report reached the limit. Help!!!

    Hello Everyone,
    This might be dumb question. But why do get this error with a IR report? and what is the solution for this. Please help me with this.
    Error
    The number of display columns in the report reached the limit. Please click Select Columns under Actions menu to minimize the report display column list.
    Oh.. And also i have a blob column.. if the format is not given, then the table is fine.. but happen to get this error only when the blob download format is given.
    Thanks and regards
    John
    Edited by: JB on Mar 30, 2012 11:08 AM

    Hi,
    i have set up a small test case on apex.oracle.com and I receive the same error if I use download format.
    I have a table
    test_blob (id number, name varchar2(10), blobcont blob)
    If I create IR like
      select
        id,
        name,
        blobcont
      from test_bloband then I define download format I hit the error.
    If you want this to work you have to change your query to
      select
        id,
        name,
        dbms_lob.getlength(blobcont) blobcont
      from test_blobAnd then again define download format for blob on blobcont column.
    Regards,
    Aljaz

  • Display Columns from WBS and Activities in the same Report

    Does anyone know how to display Columns from a WBS and an Activity together so that they can be output to Excel?
    I need WBS Code, Actual Start, Actual Finish and Performance % Complete from the WBS and Activity Codes from Activities.
    I can produce them in a report but this gives me all the activities in a heirarchical format which then necessitates deleting the activity lines in Excel
    The Performance % complete which I want is available in Activities at the Summary Level but the Activity Codes are not at this level
    I could put the Activity Codes in as Project Codes at the WBS level but this will require a lot of maintenance
    Maybe someone knows an easy way to do this?
    John
    Edited by: user9088233 on Feb 3, 2010 11:50 PM

    user9088233,
    Your request interested me so I gave it the old college try. There are several ways to go about this task but here's one that is fairly quick and easy.
    I carefully read your description of what you need from P6. I've built a test layout using the fields that you outlined. Here's what I came up with. This should bypass the issue of having to create a P6 export. My solution is to build a customized layout in P6 and copy that info and paste it into an Excel spreadsheet.+
    Open P6
    Open neccessary projects & open a new layout containing these columns:
    ....Project, WBS,Activity ID, Activity Name, Perf. %, & (any codes or user defined codes)
    Group & Sort by: Project, WBS
    ....*Display Options* = "Show Group Totals" & "Show Summaries Only", Choose "OK"
    ....*Edit*, Select, All, Copy
    Open Excel
    ....Paste Highlighted data into your new worksheet.
    Hope this helps but it's usually hard to understand exactly what you need unless I can view your data,
    Good Luck & let me know how it turns out,
    p3_scheduler
    Edited by: p3_scheduler on Feb 8, 2010 2:40 PM

  • Conditionally displayed columns of interactive report not displayed

    We have an interactive report in which few of the columns have been defined with conditions for display.
    But on the interactive report page, when the conditions are satisfied these columns do not display in the report by default.
    These columns are found in the 'Select Columns' -> 'do not display' pane. Everytime the report is run, these columns need to be selected using the select column.
    Is there anyway to make the columns appear in the report by default, when conditions are true.

    Thanks Jari for your help.
    For this issue, we finally came up with a work around.
    we removed the conditions from all the columns then ran the application report page.
    Clicked on Select Columns and moved the columns from the do not display pane to the right pane.
    Ordered them as needed. Then saved the report as primary.
    Then again went to the edit page-> interactive report and applied the conditions to the necessary columns.
    and it worked.
    When I went to the report these columns are displayed by default.

  • The number of display columns in the report reached the limit" Interactive Report

    I get the error message of "The number of display columns in the report reached the limit" when trying to display less than 100 (100 is limit) columns when an aggregate has been created.   This does not happen when an aggregate has not been added to the IR report.  It seems to happen because I have a control break on as well.  When I turn off the control break it works but is not the result that we want.  Interesting enough, if I filter the results down to 500 rows it works just fine.  Does oracle treat aggregates as columns!?  This is a really odd issue that I really need to clear up.
    Oracle 11g
    apex 4.1.0.33
    Thanks in advance,
    Shawn.

    Hi,
    i have set up a small test case on apex.oracle.com and I receive the same error if I use download format.
    I have a table
    test_blob (id number, name varchar2(10), blobcont blob)
    If I create IR like
      select
        id,
        name,
        blobcont
      from test_bloband then I define download format I hit the error.
    If you want this to work you have to change your query to
      select
        id,
        name,
        dbms_lob.getlength(blobcont) blobcont
      from test_blobAnd then again define download format for blob on blobcont column.
    Regards,
    Aljaz

  • Report "Display Text (Based on LOV)" columns don't like colons - Bug?

    This is a bit hard to explain in text, so I've built a sample app: http://apex.oracle.com/pls/otn/f?p=9608:1
    The app has two pages, which demonstrate two related bugs in the handling of Report "Display as Text (based on LOV)" columns.
    Basically, if the LOV query returns a string that contains colon characters (":") in the display column, the values are matched up correctly, but the colons are stripped from the display.
    If the LOV query returns a string that contains colon characters in the return value column, then the matching fails entirely.
    Removing the colon characters eliminates the problem.
    We actually ran into this in a production environment, after an upgrade from Apex 3.0.0 to 3.2.1. The behavior definitely did not occur in Apex 3.0, but was added at some point between the two versions.

    The colon is actually part of our data (the field in question is a URN namespace).
    And yes, I understand the function of the colon in Apex URL parameter passing. However, I wouldn't expect that sort of parsing to be used against the results returned from an LOV query.
    Also, the LOV is fine in of itself -- a select list based on the LOV displays & returns the expected values. It's only when I use a report column based on an LOV that this behavior creeps in.
    We've found a (fairly painful) workaround -- altering both the report query and the LOV query to to do something like replace(column, ':', '_') -- but that's a manual change to a large number of pages for us.
    This behavior is new to version 3.2.1. It didn't happen in version 3.0.

  • Conditional display column in report

    Hi,
    If we have a single row report of 30 columns, and I want to display only the one with any values but null and hide the null ones, Is there a way to do it?
    It's the same issue discussed in this thread conditional display column in report
    thanks,
    Fadi.

    Samara - I suspect there are a few ways to do this, but none obvious or very easy as far as I can see.
    You can create dynamic SQL (as Arie and others have suggested) to only include the columns that are not null.
    You can build and output the HTML directly to the page, choosing only to include the values that are not null.
    You can create a set of conditions that you can apply to the report columns. A very crude example might be 30 hidden page items like 'SHOW_COL1' etc. (not great, I know), or perhaps you could set a hidden page item to a value like '01:02:03:'etc., with the number only being included if the value is not null (so that col3 being null gives you '01:02::04'etc.), so that the condition for each column is 'Text in expr 1 in contained in Item in expr 2', where expr 1 is '01' for column 1 etc.
    Sorry, that is a very contrived example, but it's just to illustrate that there's generally a way of doing pretty much anything in APEX. You might create your item containing the comparison expression by requerying the data in this kind of way:
    SELECT NVL2(column1, '01', '') || ':' || NVL2(column2, '02', '') || ':' etc.
    FROM table
    WHERE condition
    However, wanting to create a single-row report with nulls hidden makes we wonder what you're actually trying to achieve and whether there's a better way? Could you use a series of page items, for example?
    John.

  • ME2N report displaying more columns in Background than foreground.I want same columns in Background as Foreground

    Hi All,
    ME2N report displaying more columns in Background than foreground.I want same columns in Background as Foreground having 10 columns.Already i have created the default variant in foreground when i execute the report in background by proving the same variant it is displaying more columns almost 70 columns.Kindly suggest and guide me how to restrict the report to get same columns in background as in foreground.
    Kindly provide is there any OSS Note available.
    Thanks,
    Prashanth Reddy

    I do not think it is possible to assign default layout for background job.
    System will show you all field for background job for transaction ME2N.
    Actually the screen layout is assigned with t-code (ME2N)
    When the report is running in foreground, then system will take the screen layout for the t-code.
    But when you run the background, then system will run the program directly (does not take the t-code). So the default screen layout will not fetch during running the background job.
    For more details have a look into the thread Selecting layout in selection screen

  • Hints on Interactive Report's column headers

    Hi,
    I've used +"< spa.n title = "Hint" > Header < / span>"+ (the first 'spa.n' is so it doesn't interpret as code) to put hints on my report columns headers but found that, when using interactive report's tools, the column names that appear obviously include the "code".
    Is there any way to put hints on interactive report columns and still maintain the proper title(in this case Header) when using the tools?
    Thank you,
    Marc

    Hi,
    Thank you for the tip Ghoulies. The spaces I put trying to make it read as text. The code works fine, it actually shows the Header in the report's column and the hint appears on mouse-over.
    What I mean is, when using interactive report's tools, such as "Select Columns", The <span title="hint">header</span> {code} appears as the column name in the +display / not display+ boxes.
    Is there any other way to put hints on Interactive reports so that this doesn't happen?
    Marc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Report displayed based on Select List condition

    Hello,
    Any help would be appreciated.
    I have a report and a select list, P55_MISSING. The select list contains the column names in the table that the report displays.
    If I select one of the column names, I would like to display all records where that column name is null.
    The sql I have at the moment is:
    select
    "ID",
    "APPLICATION",
    "SHORT_DESCRIPTION",
    "DESCRIPTION",
    "OPC_NET_NAMES",
    "PROCESSING_SCHEDULE",
    "PROCESSING_REGULARITY",
    "PLATFORMS_INVOLVED",
    "UNIX_DIRECTORIES",
    "SOURCE_FILES",
    from "APP_METADATA"
    where :P55_MISSING IS NULL
    If I select 'source files' for example, I would expect to see 3 out of 4 records stored in the table. However, I receive the message 'no data found'.
    Any help would be great. Thank you.

    Hi
    In order to doe this you will have to use dynamic sql (so you have to change your report type to 'SQL Query (PL/SQL Function Body Returning SQL Query)').
    It would then look something like this...
    DECLARE
    l_sql VARCHAR2(32767);
    BEGIN
    l_sql := 'SELECT id,
                     application,
                     short_description,
                     description,
                     opc_net_names,
                     processing_schedule,
                     processing_regularity,
                     platforms_involved,
                     unix_directories,
                     source_file
              FROM   app_metadata
              WHERE ';
    l_sql := l_sql||:P55_MISSING||' IS NULL';
    RETURN l_sql;
    END;Sorry, I can't test this as I don't have your tables.
    Cheers
    Ben

  • Interactive Report Display

    When a report is grouped by one column, is there anyway to have that column display once instead of for each record? I can do this easily in Crystal and we're in the process of loading BI Publisher...just wonder if it's possible in coding the reports directly in the Apex report display.

    Thanks to both of you!!
    Just new learned how to write complex collections (thanks BLARMAN!!) and then the simple stuff I don't know...
    All the best,
    A

  • Report Template, Column Template, Column Template Condition

    I have a template, Standard Revenue from Standard, I have cloned for a Classic report.
    Application ###>Shared Componets>Templates>Edit Report Template
    Column Template 1 looks like:
    <td#ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="t1data_revenue">#COLUMN_VALUE#</td>
    I have set Column Template 1 Condition to:
    "Use based on PL/SQL expresiion"
    I have tried several expression in "Column Template 1 Expression" - last one is:
    case
    when #COLNUM# <= 2 then false
    when #COLUMN_VALUE# < 0 then true
    else false
    end case;
    I am trying to use the value in "Column Template 2" when to value of the #COLUMN_VALUE# < 0
    where "Column Template 2" is :
    <td#ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="t1data_revenue_negative">#COLUMN_VALUE#</td>
    I get the following error when I run the page:
    ORA-01403: no data found
    and
    ERR-1025 Error processing PLSQL expression. case when #COLNUM# <= 2 then false when #COLUMN_VALUE# < 0 then true else false end case;
    Any help will be appreciated.
    thank you,
    jwm

    Hi,
    That's actually easier. See: [http://apex.oracle.com/pls/otn/f?p=267:60]
    The SQL for both reports is:
    SELECT EMPNO, ENAME, NVL(SAL,0) SAL, NVL(COMM,0) COMM
    FROM EMP
    ORDER BY EMPNOThe SAL and COMM columns have been formatted using:
    999G999G999G999G990D00For the Row Template, the Row Template 1 setting contains an empty space (you have to have something in there otherwise Apex adds back in a default row containing five cells!). The condition for this is:
    TO_NUMBER('#COMM#','999G999G999G999G990D00') < 100The template will see the data as a string, so we use the same number format to convert that string back into a number and compare this to 100. If we didn't use formatting on the numbers and we are sure that every row contained a number (hence the use of NVL()), then you could use:
    #COMM# < 100Row Template 2 contains the format for the rows that need displaying:
    &lt;tr&gt;
    &lt;td class="t18Data"&gt;#1#&lt;/td&gt;
    &lt;td class="t18Data"&gt;#2#&lt;/td&gt;
    &lt;td class="t18Data" style="text-align:right"&gt;#3#&lt;/td&gt;
    &lt;td class="t18Data" style="text-align:right"&gt;#4#&lt;/td&gt;
    &lt;/tr&gt;and is unconditional.
    The only other settings on the Row Template are the Before Rows:
    &lt;table class="t18Standard" style="border-collapse:collapse; border:1px solid black;"&gt;
    &lt;tr&gt;
      &lt;th class="t18ReportHeader"&gt;Empno&lt;/th&gt;
      &lt;th class="t18ReportHeader"&gt;Ename&lt;/th&gt;
      &lt;th class="t18ReportHeader" style="text-align:right"&gt;Sal&lt;/th&gt;
      &lt;th class="t18ReportHeader" style="text-align:right"&gt;Comm&lt;/th&gt;
    &lt;/tr&gt;and After Rows:
    &lt;/table&gt;Of course, you will note that the record counters at the bottom still show the number of records in both reports - as the SQL still outputs the same data, this doesn't change.
    Andy

  • ALV display column

    Dear All,
    Can I get two sub column under one cloumn in ALV report display?
    like '30 days' is first column and under that I need 'USD' and 'EUR'
    Thanks,
    Fed

    Hi Fed,
         I do't think so its possible with FM of ALV's, this can be done using Write statements.
    Regards,
    Suneel Kumar G

Maybe you are looking for

  • Same batch selected in two different Deliveries

    Dear all I have a problem in Outbound delivery creation.. I have created 2 different outbound deliveries. While creating & Batch determination of first outbound delivery  Batch number X with qty 100 is selected. Then it is saved with out PGI. when i

  • No entry in table $ for key $ at $ T555A 000900 01/01/2010

    Hi All While running time evaluation, i am getting this error, plz guide "No entry in table $ for key $ at $ T555A 000900 01/01/2010" REX

  • HT4352 How do I add a second iTunes library?

    I Have Apple TV that is sharing with my housemate. His is coming up on home sharing. How do I add mine?

  • Compiling a project with referenced VI

    Hello All, -I am referencing a VI in my project using Open VI Reference (see attachment).  -The VI is under a folder in my Program Files directory and is referenced statically in my project, and is separate from my project folder.  So there is no cal

  • Error opening photoshop

    Hello there , I have problem opening adobe photoshop , whenever I try to open photoshop or open any image with photoshop it gives me same error : not a valid win32  application , i tried everything , tried opening as administrator but same error ever