SQL REPORT BUT SEARCH PROBLEM ON CREATED_ON Column

Hi Friend,
i have create SQL Report .
My Code
select      CRM_SALES_DEALs.id,
                    "CRM_SALES_CUSTOMERS"."CUSTOMER_NAME" as "CUSTOMER_NAME",
      "CRM_SALES_SALESREPS"."REP_LAST_NAME"||', '||
      "CRM_SALES_SALESREPS"."REP_FIRST_NAME" as "REP_NAME",
       "CRM_SALES_DEALS"."DEAL_CLOSE_DATE" as "DEAL_CLOSE_DATE",
       "CRM_SALES_DEALS"."DEAL_PROBABILITY" as "DEAL_PROBABILITY",
      "CRM_SALES_DEAL_STATUS_CODES"."STATUS_CODE" as "STATUS_CODE" ,
         "CRM_SALES_DEALS"."DEAL_AMOUNT" *
         "CRM_SALES_DEALS"."DEAL_PROBABILITY" / 100 weighted_forecast,
(select count(*) from CRM_SALES_DEAL_notes where deal_id = "CRM_SALES_DEALS".id) notes,
(select count(*) from CRM_SALES_DEAL_products where deal_id = "CRM_SALES_DEALS".id) products,
nvl("CRM_SALES_DEALS".updated_on,"CRM_SALES_DEALS".created_on) last_changed,
t.territory_name,
CRM_SALES_DEALS.qtr, "CRM_SALES_DEALS"."CONTACT_NAME" as "CONTACT_NAME"
from     
"CRM_SALES_SALESREPS",
"CRM_SALES_DEAL_STATUS_CODES" ,
"CRM_SALES_CUSTOMERS",
"CRM_SALES_DEALS",
CRM_SALES_territories t
where  
CRM_SALES_customers.customer_territory_id = t.id(+) and
"CRM_SALES_DEALS"."CUSTOMER_ID"="CRM_SALES_CUSTOMERS"."ID"(+)
and      "CRM_SALES_DEALS"."DEAL_STATUS_CODE_ID"="CRM_SALES_DEAL_STATUS_CODES"."ID"(+)
and      "CRM_SALES_DEALS"."SALESREP_ID_01"="CRM_SALES_SALESREPS"."ID"(+)
and (:p1_find is null or instr(upper("CRM_SALES_CUSTOMERS"."CUSTOMER_NAME"),upper(:p1_find))>0 or instr(upper("CRM_SALES_DEALS"."DEAL_NAME"),upper(:p1_find))>0 or
instr(upper("CRM_SALES_SALESREPS"."REP_FIRST_NAME"||' '||"CRM_SALES_SALESREPS"."REP_LAST_NAME"),upper(:p1_find))>0)
and
(nvl(:P1_TERRITORY,0) = 0 or t.id= :P1_TERRITORY)
and
(nvl(:P1_ACCOUNT,0) = 0 or "CRM_SALES_CUSTOMERS".id = :P1_ACCOUNT)
and
(nvl(:P1_QUARTER,'0') = '0' or CRM_SALES_deals.qtr = :P1_QUARTER)
and
nvl(DEAL_PROBABILITY,10) between nvl(:P1_MINIMUM_PROBABILITY,0) and nvl(:P1_MAXIMUM_PROBABILITY,100) or
instr(upper("CREATED_ON"),upper(nvl(:P1_CREATE_DATE,"CREATED_ON")))My TAble
CREATE TABLE  "CRM_SALES_DEALS"
   (     "ID" NUMBER,
     "CUSTOMER_ID" NUMBER NOT NULL ENABLE,
     "DEAL_NAME" VARCHAR2(255),
     "DEAL_CLOSE_DATE" DATE NOT NULL ENABLE,
     "DEAL_CLOSE_DATE_ALT" DATE,
     "DEAL_STATUS_CODE_ID" NUMBER,
     "DEAL_CUSTOMER_LOCATION" VARCHAR2(4000),
     "CREATED_BY" VARCHAR2(255),
     "CREATED_ON" DATE,
     "UPDATED_BY" VARCHAR2(255),
     "UPDATED_ON" DATE,
     "QTR" VARCHAR2(8),
     "DEPARTURE_DATE" DATE,
     "DEAL_SOURCE" VARCHAR2(15),
     "ADDRESS1" VARCHAR2(255),
      PRIMARY KEY ("ID") ENABLE
/i want to search with CREATE_ON Column.
How can i create code for search in my Quary Code.
My Item is :P1_CREATE_DATE
I have try it in last Line in code but it's show me Error.Invalid Relational Operator .
How can i slove and serch with Created_on Column.
Thanks
Edited by: 805629 on Dec 27, 2010 9:13 PM
Edited by: 805629 on Dec 27, 2010 9:13 PM

Hi Friends,
i have sortout this problem.
Thanks

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

  • SQL statement - tricky search problem

    Hi,
    I am working in asp and use an Access db. I have a database
    with 500 shops around the world, the table contains among other
    things shop name, country and region (Europe, Asia etc). Then a
    search page with dropdown lists, one for Region and one for
    Country. Here is the problem, which seems easy first, but I really
    can´t get the sql statement to do what I want:
    The Region list has the following values:
    Any region
    Europe
    Asia
    etc
    The country list has te following values:
    Any country
    Sweden
    Germany
    USA
    etc
    Ok, so the problem is if the user choose "Any Region" and
    "Any Country" all shops should come up. "Europe" and "Any Country"
    should give all shops in Europe". "Any region" and "Sweden" should
    pull up ONLY shops in Sweden. "Europe" and "Sweden" should also
    pull up shops in Sweden only.
    Now you start see the problem. I have laborated with AND resp
    OR statments and also % resp xyz in the "Any Country" and "Any
    Region" values.
    Any help would be highly appreciated! Thanks!!

    Thank Manish,
    Could you tell me how to restrict in following codes?
    select
    e.EQUIPMENT_ID,
    e.HOST_NAME,
    e.SERIAL_NUMBER,
    e.CITY,
    e.ROOM,
    e.RACK,
    e.CR_DT,
    e.CR_USR,
    e.LM_USR,
    e.LM_DT,
    e.TASK_TASK_ID
    from SVR_EQUIPMENT e
    where
    instr(upper(e.SERIAL_NUMBER),upper(nvl(:P1_REPORT_SEARCH,e.SERIAL_NUMBER))) > 0 and
    instr(upper(e.CITY),upper(nvl(:P1_REPORT_SEARCH,e.CITY))) > 0 and
    instr(upper(e.CR_USR),upper(nvl(:P1_REPORT_SEARCH,e.CR_USR))) > 0 or
    instr(upper(e.LM_USR),upper(nvl(:P1_REPORT_SEARCH,e.LM_USR))) > 0
    Thanks for all again,
    Sam

  • Sql report on item - problem with commas in the string

    I have a simple report that groups all the Job Titles entered on our database.
    I pass the job title to an apex item and then on a second page list the records that match that job title using:
    and ed.ede_job_title = :P35_JOB_TITLE
    If there is a comma in the job title the report returns the records that match the string up to the point the comma appears not the full string.
    So 'Project Manager, Operations' matches all the 'Project Manager' records.
    Also when there is a leading space in the job title the report displays the jobtitle without the leading space.
    Apologies if this is answered elsewhere, I did search.

    Check the actual URL up in the location bar. Your comma may actually be dropping out there, because it isn't encoded such that in value commas can be differentiated from delimiters, so the fields aren't lining up in the URL properly.
    When you go to a page that takes in parameters for assignment in the link, it has 2 fields. The first is the comma separated list of the item names on the page to assign, which wouldn't contain commas in their names. The other field in the URL is a comma separated list of values to be assigned to the previous list. Since these values aren't encoded, the comma in the value is picked up as delimiter and not a part of the value. I have an example I can load up to apex.oracle.com if you need.
    -Richard
    Edited by: rwendel on Aug 13, 2009 11:51 AM

  • Bug - Sorting Order in SQL Reports not Working?

    Today i defined a SQL Report in APEX and choose 3 columns for sorting the report.
    The order is like that:
    1. Category
    2. List Price
    3. Product Name
    When calling the SQL Report in a new session i expected to get a sorted report like defined.
    I got only the report like the last person who edited this report.
    It looks like that the Sort Sequence columns is not usable in SQL Reports.
    Here is an example based on the problems which i described:
    http://apex.oracle.com/pls/apex/f?p=40082
    below the SQL Report a screenshot is shown, where the Report Attributes (and the sort sequence) is displayed.

    OliverL
    Did you reset the pagination of the report you made the changes to?
    Normal behaviour is that APEX remembers per user per report the last sorting that was used.
    Including when a user clicked a column header to change the order from the default one.
    The sort preference are stored in preferences with a name like FSPapp_id_Ppage_id_Rinternal region_id_SORT.
    Nicolette

  • Passing multiple values to another page via a sql report

    Having trouble passing multiple values to another page via a popup SQL report
    I have two fields one called "descr" and another called "Met"
    when I use the code below all works fine and the value of "descr" is passed
    Select '<a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_TYPE:'
    || descr
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
    || descr
    || '</a>' "Note"
    But when I want to pass another value, all goes bonkers and instead of the value of the field being passed the literal text is passed.
    can someone look at my code below and see what may be wrong
    Select '<a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_TYPE,P950_CODE:'
    || descr, Met
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
    || descr
    || '</a>' "Note"
    I appeciate your help looking into this
    FYI (Here is the entire SQL for reference)
    With t
    as
    (SELECT
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_CPT > :P940_METRIC_1_WCS_CPT1 then
    '<span style="color:Red; ">'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'</span>' else
    '<span style="color:#399304; ">'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'</span>' end
    else '<span style="color:#180c8b;">'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'</span>' end "WCSCPT",
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_TOI_PER_FTE < :P940_METRIC_2_WCS_TOI_PER_FTE then
    '<span style="color:Red; ">'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'</span>' else
    '<span style="color:#399304; ">'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'</span>' end
    else '<span style="color:#180c8b;">'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'</span>' end "WCSTOIPERFTE",
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_SIO_PER_FTE < :P940_METRIC_3_WCS_SIO_PER_FTE then
    '<span style="color:Red; ">'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'</span>' else
    '<span style="color:#399304; ">'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'</span>' end
    else '<span style="color:#180c8b;">'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'</span>' end "WCSSIOPERFTE",
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_TC_PER_FTE < :P940_METRIC_4_WCS_TC_PER_FTE then
    '<span style="color:Red; ">'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'</span>' else
    '<span style="color:#399304; ">'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'</span>' end
    else '<span style="color:#180c8b;">'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'</span>' end "WCSTCPERFTE",
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_ADSL_PER_FTE < :P940_METRIC_5_WCS_DSL_PER_FTE then
    '<span style="color:Red; ">'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'</span>' else
    '<span style="color:#399304; ">'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'</span>' end
    else '<span style="color:#180c8b;">'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'</span>' end "WCSADSLPERFTE",
    CASE WHEN KEY = 2 THEN
    TO_CHAR(MONTH,'MON-YY')
    else
    'METRICS'
    end "MONTH"
    FROM (
    SELECT DISTINCT
    ROW_NUMBER() OVER (ORDER BY KEY DESC) AS ROW_NUM, KEY, WCS_CPT, WCS_TOI_PER_FTE, WCS_SIO_PER_FTE, WCS_TC_PER_FTE, WCS_ADSL_PER_FTE, MONTH
    from TW_M_KEYMETRICS
    WHERE TO_DATE(UPPER(MONTH),'DD/MON/YY') >= TO_DATE(UPPER(:P940_START_OF_THIS_FIN_YEAR),'DD/MON/YY')
    ORDER BY KEY ASC, ROW_NUM, MONTH)
    WHERE ROW_NUM <= :P940_MONTHS_SINCE_FIN_START)
    Select '<a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_METRIC_TYPE,P950_METRIC_VALUE:descr,MET'
    || ''
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
    || descr
    || '</a>' "Note"
    , max(Met) METRICS, max(Jul) Jul08, max(Aug) Aug08, max(Sep) Sep08, max(Oct) Oct08, max(Nov) Nov08, max(Dec)Dec08, max(Jan) Jan08, max(Feb) Feb08, max(Mar) Mar08, max(Apr) Apr08, max(May) May08, max(Jun) Jun08
    from (
    Select 'Cost Per Transaction' descr,
    decode (MONTH, 'METRICS', WCSCPT) MET,
    decode (MONTH, 'JUL-08', WCSCPT) Jul,
    decode (MONTH, 'AUG-08', WCSCPT) Aug,
    decode (MONTH, 'SEP-08', WCSCPT) Sep,
    decode (MONTH, 'OCT-08', WCSCPT) Oct,
    decode (MONTH, 'NOV-08', WCSCPT) Nov,
    decode (MONTH, 'DEC-08', WCSCPT) Dec,
    decode (MONTH, 'JAN-08', WCSCPT) Jan,
    decode (MONTH, 'FEB-08', WCSCPT) Feb,
    decode (MONTH, 'MAR-08', WCSCPT) Mar,
    decode (MONTH, 'APR-08', WCSCPT) Apr,
    decode (MONTH, 'MAY-08', WCSCPT) May,
    decode (MONTH, 'JUN-08', WCSCPT) Jun
    from t
    union all
    Select 'Total Orders Issued Per FTE' descr,
    decode (MONTH, 'METRICS', WCSTOIPERFTE) MET,
    decode (MONTH, 'JUL-08', WCSTOIPERFTE) Jul,
    decode (MONTH, 'AUG-08', WCSTOIPERFTE) Aug,
    decode (MONTH, 'SEP-08', WCSTOIPERFTE) Sep,
    decode (MONTH, 'OCT-08', WCSTOIPERFTE) Oct,
    decode (MONTH, 'NOV-08', WCSTOIPERFTE) Nov,
    decode (MONTH, 'DEC-08', WCSTOIPERFTE) Dec,
    decode (MONTH, 'JAN-08', WCSTOIPERFTE) Jan,
    decode (MONTH, 'FEB-08', WCSTOIPERFTE) Feb,
    decode (MONTH, 'MAR-08', WCSTOIPERFTE) Mar,
    decode (MONTH, 'APR-08', WCSTOIPERFTE) Apr,
    decode (MONTH, 'MAY-08', WCSTOIPERFTE) May,
    decode (MONTH, 'JUN-08', WCSTOIPERFTE) Jun
    from t
    union all
    Select 'SIOs Per Billing FTE' descr,
    decode (MONTH, 'METRICS', WCSSIOPERFTE) MET,
    decode (MONTH, 'JUL-08', WCSSIOPERFTE) Jul,
    decode (MONTH, 'AUG-08', WCSSIOPERFTE) Aug,
    decode (MONTH, 'SEP-08', WCSSIOPERFTE) Sep,
    decode (MONTH, 'OCT-08', WCSSIOPERFTE) Oct,
    decode (MONTH, 'NOV-08', WCSSIOPERFTE) Nov,
    decode (MONTH, 'DEC-08', WCSSIOPERFTE) Dec,
    decode (MONTH, 'JAN-08', WCSSIOPERFTE) Jan,
    decode (MONTH, 'FEB-08', WCSSIOPERFTE) Feb,
    decode (MONTH, 'MAR-08', WCSSIOPERFTE) Mar,
    decode (MONTH, 'APR-08', WCSSIOPERFTE) Apr,
    decode (MONTH, 'MAY-08', WCSSIOPERFTE) May,
    decode (MONTH, 'JUN-08', WCSSIOPERFTE) Jun
    from t
    union all
    Select 'Total Calls Answered per FTE' descr,
    decode (MONTH, 'METRICS', WCSTCPERFTE) MET,
    decode (MONTH, 'JUL-08', WCSTCPERFTE) Jul,
    decode (MONTH, 'AUG-08', WCSTCPERFTE) Aug,
    decode (MONTH, 'SEP-08', WCSTCPERFTE) Sep,
    decode (MONTH, 'OCT-08', WCSTCPERFTE) Oct,
    decode (MONTH, 'NOV-08', WCSTCPERFTE) Nov,
    decode (MONTH, 'DEC-08', WCSTCPERFTE) Dec,
    decode (MONTH, 'JAN-08', WCSTCPERFTE) Jan,
    decode (MONTH, 'FEB-08', WCSTCPERFTE) Feb,
    decode (MONTH, 'MAR-08', WCSTCPERFTE) Mar,
    decode (MONTH, 'APR-08', WCSTCPERFTE) Apr,
    decode (MONTH, 'MAY-08', WCSTCPERFTE) May,
    decode (MONTH, 'JUN-08', WCSTCPERFTE) Jun
    from t
    union all
    Select 'ADSL Orders per FTE' descr,
    decode (MONTH, 'METRICS', WCSADSLPERFTE) MET,
    decode (MONTH, 'JUL-08', WCSADSLPERFTE) Jul,
    decode (MONTH, 'AUG-08', WCSADSLPERFTE) Aug,
    decode (MONTH, 'SEP-08', WCSADSLPERFTE) Sep,
    decode (MONTH, 'OCT-08', WCSADSLPERFTE) Oct,
    decode (MONTH, 'NOV-08', WCSADSLPERFTE) Nov,
    decode (MONTH, 'DEC-08', WCSADSLPERFTE) Dec,
    decode (MONTH, 'JAN-08', WCSADSLPERFTE) Jan,
    decode (MONTH, 'FEB-08', WCSADSLPERFTE) Feb,
    decode (MONTH, 'MAR-08', WCSADSLPERFTE) Mar,
    decode (MONTH, 'APR-08', WCSADSLPERFTE) Apr,
    decode (MONTH, 'MAY-08', WCSADSLPERFTE) May,
    decode (MONTH, 'JUN-08', WCSADSLPERFTE) Jun
    from t
    GROUP by descr
    Frank

    Borg Species 5618 wrote:
    Having trouble passing multiple values to another page via a popup SQL report
    But when I want to pass another value, all goes bonkers and instead of the value of the field being passed the literal text is passed.
    can someone look at my code below and see what may be wrong
    Select '<a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_TYPE,P950_CODE:'
    || descr, Met
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
    || descr
    || '</a>' "Note"
    Hi Frank,
    You should close this parameters with single quotation. Try this -
    Select '<a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_TYPE,P950_CODE:'
    *|| 'descr, Met'*
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
    || descr
    || '</a>' "Note"
    Hope this helps.
    Regards,
    M Tajuddin
    http://tajuddin.whitepagesbd.com

  • Dynamic SQL report  on Oracle apex4.0

    Hi Everyone,
    I have two reports in one page.One is the Interactive and other is Sql report. Based on the selection of the row(using checkbox) in the interactive report, the sql report has to display the selected columns.
    Note :The report has to be loaded whenever a row is selected and without submitting a button
    Can anyone please suggest?
    I am using oracle Apex4.0
    Regards
    Raj

    I believe you store the values in the checkboxes. For example, your Interactive Report query looks like:
    SELECT '<input type=checkbox value='||OBJID||' />' AS CHECKBOX, T.*
    FROM SOME_TABLE T
    and in "Report Atributes" the CHECKBOX is displayed as "Standard Report Column".
    *1.Create a hidden check list input field.*
    It will store a list values of selected checkboxes. make it long enough, eg. 1000.
    Let's say the input name is: P000_X_CHECK_LIST
    *2. Create Dynamic Action*
    This dynamic action is supposed to fill in the P000_X_CHECK_LIST with a list of values, separated by ":" character.
    These values will be an input for the SQL report.
    Name: Update Check List
    Event: Change
    Selection Type: jQuery Selector
    jQuery Selector: input:checkbox
    Action: Set Value
    Set Type: JavaScript Expression
    function check_list() {
    var n = "";
    $(":checked").each( function () {
    n = n + (n === "" ? "" : ":") + $(this).val();
    return n;
    check_list();
    Selection Type: Item(s) - P000_X_CHECK_LIST
    *3. Adjust the "SQL report" query with this magic formula*
    AND SEARCHED_ITEM IN (
    SELECT item
    FROM (SELECT REGEXP_SUBSTR (str, '[^:]+', 1, LEVEL) item
    FROM (SELECT :P000_X_CHECK_LIST str
    FROM DUAL)
    CONNECT BY LEVEL <= length (regexp_replace (str, '[^:]+')) + 1)
    for example:
    SELECT O.*
    FROM SOME_OTHER_TABLE O
    WHERE SEARCHED_ITEM IN (
    SELECT item
    FROM (SELECT REGEXP_SUBSTR (str, '[^:]+', 1, LEVEL) item
    FROM (SELECT *:P000_X_CHECK_LIST* str
    FROM DUAL)
    CONNECT BY LEVEL <= length (regexp_replace (str, '[^:]+')) + 1)
    *4. Adjust the Dynamic Action:*
    Advanced: Event Scope: "live"
    *5. Add one more True action to the Dynamic Action:*
    Action: Refresh
    Selection type: Region
    Region: The region of the "SQL report".
    Volia!
    Best regards,
    Krzysztof

  • Displaying connect by indent in updatable sql report

    We have several normal reports that indent the identifying number field in connect by order. We also would like to do this in updatable sql reports, but they reject our attempts to use    for the indent characters in our rpad statement.

    Please see the other message sent with this. Here is the entire sql with amperands and ; removed fromt he nbsp characters.
    SELECT rpad(' ', 2 * (LEVEL - 1) + 1, 'nbspnbsp') || pr2.projectno, pr2.NAME,
    pr2.person_months, pr2.percent_staffed,pr2.test_months, pr2.testpercent_staffed
    FROM projects_view pr2
    START WITH pr2.projectno IN
    (Select pr.projectno from projects_view pr
    where pr.num_children>0 AND
    pr.projectno like NVL(:p205_projectno,'%') and
    pr.name like NVL(:p205_name,'%') and
    pr.releaseno LIKE NVL(:p205_release,'%') AND
    pr.delete_flag='N')
    CONNECT BY pr2.parent_projectno = PRIOR pr2.projectno

  • How to rename C00n generic column names in a Dynamic SQL report

    I have a an interface whereby the user can select 1 to 60 (upper limit) columns out of 90 possible columns (using a shuttle) from one table before running a report.
    To construct the SQL that will eventually execute, I'm using a "PLSQL function body returning SQL query" with dynamic SQL. The only problem is that I have to use "Generic Column Names" option to be able to compile the code and end up with c001 to c060 as the column names.
    How can I use the names of the selected columns as the report headings rather than c001, C002... etc?
    I do not know beforehand which columns, or how many columns or the order of the selected columns.
    I know Denes K has a demo called Pick Columns but I can't access his code. I have a hunch though that he may be just using conditions to hide/show the apropriate columns.
    thanks in advance
    PaulP

    Hi Paul
    I would change the Heading Type in the Report Details screen to PLSQL and use the shuttle item to return the column values. e.g.
    RETURN :p1_shuttle;
    I'm assuming the shuttle already has a colon separated list of the column headings in the correct order?
    I hope that helps
    Shunt

  • SQL report region and search capability

    1) I have a report and I would like to be able to cat two fields together but the problem occurs is that the query will no longer search for that field once they are "catted " together.. The field is a combo of staff id (initials) and the full name, when you search it will find staff_id but it will not search on name.
    An example is listed here: http://htmldb.oracle.com/pls/otn/f?p=860:21
    workspace:epic
    select B."BASE_UNIT_ID",S."NAME" || S."ACCESS_ACCOUNT_ID" AS STAFF_ID_combo_of_Name_and_Id, ST."ACCESS_ACCOUNT_ID" AS IMAGE_INSTALLED_BY
    from "#OWNER#"."BASE_UNIT" B LEFT OUTER JOIN "#OWNER#"."IP" I ON B."IP_ID" = I."IP_ID"
    LEFT OUTER JOIN "#OWNER#"."STAFF" ST ON B."IMAGE_INSTALLED_BY" = ST."STAFF_ID"
    LEFT OUTER JOIN "#OWNER#"."STAFF" S ON B."STAFF_ID" = S."STAFF_ID"
    where
    instr(upper(B."BASE_UNIT_ID"),upper(nvl(:P21_SEARCH,B."BASE_UNIT_ID"))) > 0 OR
    instr(upper(S."ACCESS_ACCOUNT_ID"),upper(nvl(:P21_SEARCH,S."ACCESS_ACCOUNT_ID"))) > 0 OR
    instr(upper(ST."ACCESS_ACCOUNT_ID"),upper(nvl(:P21_SEARCH,ST."ACCESS_ACCOUNT_ID"))) > 0
    2) On a side note does anyone know how to concat a space or dash between two fields for a report? I tried doing this column1 || '--' || column2 but when I tried to run the report it gave me an error and says all variables are not bound. (The query does work however in sqlplus) Currently I have managed to get by with column1 || '< /br >' || column2 but I would like both values on the same line.

    I have similar problem, my search is not working with the sql query below. Can someone tell me what wrong I am doing.
    I have 3 text fields for users to enter different search criteria, and I "GO" button to submit their search. Hope to see your reply soon. Thank you.
    select
    "BUSINESS_UNIT",
    "TURNKEY_PN_FORMULA_VER",
    "TURNKEY_DESIGNATOR_FLAG",
    "TECH_CODE_PREFIX",
    "TECH_CODE",
    "PART_NUMBER",
    "DESCRIPTION",
    "PKG",
    "NO_OF_LEADS",
    "METRIC_BODY_SIZE",
    "NO_OF_DIE",
    "NO_OF_WIRES",
    "WIRE_SIZE",
    "PB_FREE_FLAG"
    from "TURNKEY_CODES"
    where
    instr(upper("BUSINESS_UNIT"),upper(nvl(:P1_REPORT_SEARCH,"BUSINESS_UNIT"))) > 0 or
    instr(upper("TURNKEY_PN_FORMULA_VER"),upper(nvl(:P1_REPORT_SEARCH,"TURNKEY_PN_FORMULA_VER"))) > 0 or
    instr(upper("TURNKEY_DESIGNATOR_FLAG"),upper(nvl(:P1_REPORT_SEARCH,"TURNKEY_DESIGNATOR_FLAG"))) > 0 or
    instr(upper("TECH_CODE"),upper(nvl(:P1_REPORT_SEARCH,"TECH_CODE"))) > 0 or
    instr(upper("PART_NUMBER"),upper(nvl(:P1_REPORT_SEARCH,"PART_NUMBER"))) > 0
    or
    instr(upper("DESCRIPTION"),upper(nvl(:P1_REPORT_SEARCH,"DESCRIPTION"))) > 0
    or
    instr(upper("PKG"),upper(nvl(:P1_REPORT_SEARCH,"PKG"))) > 0
    or
    instr(upper("NO_OF_LEADS"),upper(nvl(:P1_REPORT_SEARCH,"NO_OF_LEADS"))) > 0 or
    instr(upper("METRIC_BODY_SIZE"),upper(nvl(:P1_REPORT_SEARCH,"METRIC_BODY_SIZE"))) > 0 or
    instr(upper("NO_OF_DIE"),upper(nvl(:P1_REPORT_SEARCH,"NO_OF_DIE"))) > 0 or
    instr(upper("NO_OF_WIRES"),upper(nvl(:P1_REPORT_SEARCH,"NO_OF_WIRES"))) > 0 or
    instr(upper("PB_FREE_FLAG"),upper(nvl(:P1_REPORT_SEARCH,"PB_FREE_FLAG")))> 0
    or
    instr(upper("PKG"),upper(nvl(:P1_W_PKG,"PKG"))) > 0
    and
    instr(upper("NO_OF_LEADS"),upper(nvl(:P1_W_LEADS,"NO_OF_LEADS"))) > 0
    )

  • Sql report, How to access current rows 6 columns data

    I have one page having page items & SQL report having 8 columns.
    First column of report is a link for editing.
    on clicking first column, that record gets displayed on page items, which are opn same page.
    Now my problem is i have used link column of report and set 3 page items value on click of link column.\
    But i need to set values for 2 more page items.
    I tried to create computation & process but not working. i am confused about which process point to select & whether onclick page gets submitted or not.
    I tried to write jscript but not succeeded. I dont know how to get current row id in jscript & different column values of current rowid.
    any help.

    Hi,
    Thanks for reply.
    in 5 items, first three are numeric and last two are timestamp fromtime, totime.
    as I mentioned earlier if i interchange 4 & 5 items i.e. now ITEM4 is totime & ITEM5 is fromtime
    and their values. I get value for totime & not for fromtime. all records contain values for all 5 columns. no null.
    So basically their is no problem in value or data, The only problem is whatever sequence is maintained first 4 items get value & 5th item remains blenk.
    Either I type all 5 ITEM NAMES in one Item name-value pair of link or use all three pairs, 5th ITEM remain blank.

  • Problem of POP LOV  in a  SQL Report  with pagination

    I am using a pop up lov (along with some other fields), HTMLDB_ITEM.POPUP_FROM_LOV(5, null, 'EMPLOYEE_LIST', '20', '50')), in a sql report. This is a report with pagination. Whenever I select any value from pop up lov on first page of the report it gets populated properly in the corresponding text field. But from second page onwards it doesn’t populate any value.
    For example, my report fetches a total of 50 rows, of which I am displaying 15 at a time. The popup lov comes with a text field for each row. Whenever I do select from popup lov for 1-15 rows which come on page 1, the values come up in the text field properly, but for rows 16-30 on second page, 31-45 on third 46-50 on fourth the values do not get populated. When I changed the pagination settings to display 40 rows..the values were still coming properly on page 1(1-40 rows) and not on the next page. Any clues… how to resolve this problem?

    good find. this is a bug that has already been identified and will be corrected in the upcoming patch release for htmldb. a good work-around for now is to use the equivalent declarative options in the tool. so rather than coding your query like...
    select ename , HTMLDB_ITEM.POPUP_FROM_LOV(2, null, 'DEPARTMENT', '20', '50') as "department" from emp
    ...just code it like this...
    select ename , null as "department" from emp
    ...and then use the column attributes screen for your "department" column to indicate that you'd like that col to be rendered as a "Popup LOV (named LOV)" using your DEPARTMENT list of values.
    hope this helps,
    raj

  • Layout in sql report gets disturbed in case of blank columns

    Hi All,
    I have an SQL report which runs from a concurrent program.
    Problem is, if there are blank columns in the report then the data shifts to the left.
    As shown in the below table, if column Attribute 4 is null then the data for Error column has shifted to the left. The words Incorrect Data should come under heading Error whereas it comes under Attribute4.
    ASSET_NUMBER_REC ATTRIBUTE_CATEGORY_CODE ATTRIBUTE4 ERROR
    316604 ABCD Incorrect Data
    Can someone help me in correcting the report layout.
    Regards,
    Shruti

    ASSET_NUMBER_REC ATTRIBUTE_CATEGORY_CODE ATTRIBUTE4 ERROR
    316604 ABCD Incorrect Data
    Can someone help me in correcting the report layout.
    Hi
    SQL Report --- Do you mean SQL Query in such case,
    Please use NVL function on all column, which will give you proper place result.

  • Please Help - SQL Report long column value required in a separate cell

    Hi.
    I need to create a SQL report with the structure like below:
    Country State City Vertical Business Details (detail desc)
    US MA Quincy Healthcare
    This is a detail desc value that needs to displayed in a different cell.
    This is a detail desc value that needs to displayed in a different cell.
    This is a detail desc value that needs to displayed in a different cell.
    This is a detail desc value that needs to displayed in a different cell.
    US MA Braintree IT
    This is a detail desc value that needs to displayed in a different cell.
    This is a detail desc value that needs to displayed in a different cell.
    This is a detail desc value that needs to displayed in a different cell.
    I came through a solution where you can hide/display the long column value in a different cell. But my requirement is that it should be displayed when the page opens and user don;t want to click on a button to see the value. This is mainly for their presentations and printing. so its very annoying for them to click on so many buttons to see the detail desc value for every record. I am new to Java script, Please help

    I'm not sure I understand your requirements--are you showing us 2 lines of data, 7 lines, or 9? Do you want the long detail description on the same row, or underneath it?
    I'm going to go on the assumption that you're showing us two rows, and that the long descriptions in this example happen to be 3-4 lines long, and that you want the long descriptions underneath the details. In which case, I suggest using "named column" templates. They're a lot easier to use than they appear when you first look at them, so bear with me.
    Under "Shared Components", select "Templates", and then click on the yellow Create> button. You're creating a report template, from scratch. On the final page of the wizard, select "Named Column (row template)" for the template type. This will create a rather generic (and useless) template, which you'll have to edit; I don't know why they chose to not send you straight into the editor. When you edit it, you'll see that the only field with a value in it is "Row Template 1", and it's set to:
    <tr><td>#1#</td><td>#2#</td><td>#3#</td><td>#4#</td><td>#5#</td></tr>For meeting your requirements with basic functionality, change it to something along the lines of:
    <tr><td>#COUNTRY#</td><td>#STATE#</td><td>#CITY#</td><td>#VERT#</td></tr>
    <tr><td colspan="4">#DETAILS#</td></tr>Then you'll probably want to put something under Column Heading Template, like:
    <tr><td>Country</td><td>State</td><td>City</td><td>Vertical Business</td></tr>
    <tr><td colspan="4">Details</td></tr>Apply whatever CSS styles you want to it, of course.
    Using the template is straightforward: if your report, chose the template, and make sure your SQL returns values using the column names you specified in your template. Otherwise, you'll see literal "#COUNTRY#" text in your report.
    You can get fancy with these, of course, such as applying different styles to alternating rows, but I'll leave this as good enough to get you started (I hope).
    -David

  • Problem in updating fa_additions SQL Error: ORA-01779: cannot modify a column which maps to a non key-preserved table

    Hi,
    After using sql loader to import informations in the table fa_mass_additions and after the functionnal uses a treatment to imputate this assets, it asks me to do an update on the table fa_additions to change the value of attribute1 but i get an error
    Error report:
    ORA-01779: cannot modify a column which maps to a non key-preserved table
    ORA-06512: at line 11
    01779. 00000 -  "cannot modify a column which maps to a non key-preserved table"
    *Cause:    An attempt was made to insert or update columns of a join view which
               map to a non-key-preserved table.
    *Action:   Modify the underlying base tables directly.
    please how can i do this update?

    Hi,
    The "fa_additions" is a view, not a table.
    You should update the base table "fa_additions_b".
    Regards,
    Bashar

Maybe you are looking for