Interactive Report  count selected rows

I have a I/R report with a checkbox is column 1 of each row using:
HTMLDB_ITEM.CHECKBOX
(1,R.RESEARCH_ID,
decode(:Pxx_SELECT_ALL_ROWS,'Y','CHECKED',
decode(instr(nvl(:Pxx_SELECTED_IDS,0),R.RESEARCH_ID),0,NULL,'CHECKED'))
AS select_flag
I want to use Javscript or a Dynamic Action to "count" how many selected rows there are, when a UPDATE button is pressed.
Right now, the UPDATE button "submits" the page, then a page item computation runs the following code to get a count:
DECLARE
v_cnt number(9);
BEGIN
v_cnt := 0;
FOR i in 1..htmldb_application.g_f01.count
LOOP
v_cnt := v_cnt + 1;
END LOOP;
return v_cnt;
This works... but I dont want to submit (and rerun the report) just to get this count.
I have copied this loop into a Dynamic Action using the Click action of the UPDATE button, but it doesnt seem to recognize htmldb_application.g_f01.count .. so my value returns as 0.
Any ideas - thanks!

I am not that strong in javascript, so I put a few alerts in the function you provided, to try to understand it better.
My example query returns 2 rows.
document.wwv_flow.f01.length returns a value = 2.
I checked both rows, then called the function.
I put an Alert inside the FOR loop in your example, it never executed.
The FOR loop in your example used a “>” sign, which never would evaluate as true, since i=0 > 2 is immediately false.
I changed the operator in the FOR loop to “<”.
The loop executed 2 times,
I displayed the with variable i : values = 0, 1
I displayed the value of document.wwv_flow.f01.id, it was NULL both iterations.
The $x(curr_id).checked is never true, so count remains = 0
function f_count_checked ()
var counter = 0;
for (var i = 0; i > document.wwv_flow.f01.length; i++) ---- I changed this to “<”
{var curr_id = document.wwv_flow.f01[i].id;
if ($x(curr_id).checked==true)
{counter = counter + 1;}}
alert ('You have checked: '+counter+' rows.');

Similar Messages

  • Interactive report on SELECT * FROM X

    Hi,
    Is there anyway to create an interactive report using SELECT * FROM my_table; where you can add a new column to "my_table" and for the interactive report to pick up the new column without having to go into the report region and hit apply changes?
    I've tried using a collection but that doesn't work as you still have to manually refresh the report region.
    I've even tried hacking my way into:
    wwv_flow_f4000_util.save_interactive_rpt_region (
    p_region_id in number,
    p_flow_id in number,
    p_plug_name in varchar2 default null,
    p_region_name in varchar2 default null,
    p_region_template in number default null,
    p_display_seq in number default null,
    p_display_column in number default null,
    p_display_point in varchar2 default null,
    p_region_source in varchar2 default null,
    p_breadcrumb_template in number default null,
    p_list_template in number default null,
    p_region_display_error_msg in varchar2 default null,
    p_required_role in varchar2 default null,
    p_display_when_cond in varchar2 default null,
    p_display_when_cond2 in varchar2 default null,
    p_display_cond_type in varchar2 default null,
    p_region_header in varchar2 default null,
    p_region_footer in varchar2 default null,
    p_region_column_width in varchar2 default null,
    p_customized in varchar2 default null,
    p_customized_name in varchar2 default null,
    p_requied_patch in number default null,
    p_url_text_begin in varchar2 default null,
    p_url_text_end in varchar2 default null,
    p_translate_title in varchar2 default null,
    p_comment in varchar2 default null);
    (Yes, I know that's bad!)
    Still can't get this to work anyway.
    There must be a way of doing this....
    Any help gratefully recieved.
    Thanks
    Yog

    Keith,
    No it doesn't.
    Here is an example.
    1. Created an interactive report with source as select * fom dept.
    2. Ran my page and saw a report based on columns deptno, dname and loc
    3. Added a column to dept called "newcol"
    4. Reran the page - columns are still deptno, dname and loc
    5. clicked on green cog / select columns and the only options avaiable are still deptno, dname and loc
    In order to get "newcol" to appear I have to edit the page, go to my report region and click Apply Changes. A summary appears with the new column "newcol" shown. I click apply changes again and run the page and only then does the new column appear.
    Cheers
    Yog

  • Interactive report with single row select

    Hi,
    Is it possible to create an interactive report that has a single row select column i.e. you can only select one row and when you select another row it deselects any row selected before, simular to a list of values but with the functionionality of an IR report.
    Thanks in advance

    Hi,
    Try adding this to the query of your report:
    select ...
           apex_item.radiogroup(1, some_unique_column) sel
    from ...You didn't say how you want to use this, but when the page is submitted the array apex_application.g_f01 may contain either none or exactly one element, which will be the some_unique_column value of the selected row.
    Luis

  • Interactive Report with specific rows editable

    I have an interactive reports, with the edit (pencil) link to a maintenance form. I only want the link to show for specific records in the reports. Can you put a condition in the link column to the pencil for certain records?
    If so, how can you access the value of the field? ie. I need to check the value of 'USER_NAME' in the select below against :APP_USER
    select A.pk_id as "PK_ID",
    A.fk_sis_user as "FK_SIS_USER",
    A.list_name as "LIST_NAME",
    A.list_description as "LIST_DESCRIPTION",
    B.user_name as "USER_NAME",
    A.creation_date as "CREATION_DATE"

    Not exactly what you are asking for, but it may give you an idea hot to create conditional
    icon and link.
    From always excellent examples from Denes Kubicek:
    http://apex.oracle.com/pls/otn/f?p=31517:23:3086073313243153::NO
    HTH
    Thomas

  • Interactive Report with select list

    Hi,
    I am trying to make an interactive report where the output is based on the choice of a value from the select list;
    the list is based on a lov:
    select name,id
    from kunden order by 1
    I created the select list named P2_KUNDEN_ID and used this in my query for the report:
    select
    lizenzen.id,
    lizenzen.produktbeschreibung,
    lizenzen.anzahl,
    lizenzen.lizenztyp,
    lizenzen.support_vertragsnr,
    lizenzen.csi_nr,
    lizenzen.startdatum,
    lizenzen.enddatum,
    lizenzen.status,
    lizenzen.zuordnung,
    lizenzen.info,
    lizenzen.kunde,
    kunden.name
    from lizenzen, kunden
    where lizenzen.kunde = kunden.id(+)
    and (lizenzen.kunde = :P2_KUNDEN_ID OR (lizenzen.kunde is null and nvl(:P2_KUNDEN_ID,'-1')=-1))
    But the report doesn't change if I make a different selection from the list. I think I made it exactly as shown in the developer's guide.
    Thx in advance.

    Hello,
    You have to use the apex_util.ir_filter
    apex_util.ir_filter(p_page_id=> 2
    ,p_report_column=>'kunde',p_operator_abbr=>'EQ',p_filter_value=>:P2_KUNDEN_ID);

  • Interactive Report with Select List LOV's

    Hi All -
    I need to develop an Interactive Report which displays reports based on values selected from a select list (LOV's) on this IR report.
    Following is what I am working on.
    This page has 2 select lists with the corresponding LOV values:
    Date From ==> Q1, 2010
    Q2, 2010
    Q3, 2010
    Q4, 2010               
    Date To ==> Q1, 2010
    Q2, 2010
    Q3, 2010
    Q4, 2010     
    When the user visits this report page first time, "Date From" and "Date To" select lists have null values and the report should display all the records.
    Once the user selects values from "Date From" and "Date To" select lists then the report should be filtered based on the values selected i.e.
    If the user selects *"Date From"* ==> Q1, 2010 and *"Date To"* ==> Q3, 2010, then the report should show all the records whose reporting period falls between "Jan 1, 2010" to "Sept 30, 2010" i.e Q1-Q3 2010 only.
    And the Reporting date format stored in the table is "18-OCT-2010", "12-APR-2010" etc ....
    How can this be achieved. Please share your expertise.
    Thanks,
    -Seenu

    Hi,
    First Create 2 Select List with List Of Queries in LOV Region like
    +'STATIC2:Q1-2010;01-Jan-2010,Q2-2010;01-Apr-2010,Q3-2010;01-Jun-2010,Q4-2010;01-Oct-2010'+ in Date From List lets name it P10_DF and
    +'STATIC2:Q1-2010;31-Mar-2010,Q2-2010;30-Jun-2010,Q3-2010;30-Jun-2010,Q4-2010;31-Dec-2010'+ in Date To List P10_DT.
    (Enable Display Null Value on both the select list)
    Then Now in the Report Source add Where Query some thing like
    select FIELD1,FIELD2 from TBL_REPORTS where Report_Date>=NVL( *:P10_DF* ,'01-Jan-2010') and Report_Date<=NVL( *:P10_DT* ,'31-Dec-2010')
    And also create a button to submit the values
    NOTE: This is not tested but this is how i will come about it in the specified scenario. You can try this and post the results...
    Good Luck.
    Regards,
    Afsar

  • Interactive Reporting - Counting Records in a Non-numeric Column

    I have created a report that shows open trouble tickets, the group they are assigned to and the status of the ticket. I would like to create another report based on the first one that shows each group and the number of tickets they have in each status category. For example:
    Group Assigned Testing Closed Total
    Bus. Analysts 2 5 0 7
    I.T. 6 2 3 11
    Is there a function in IR that can count number of rows/records?

    depending on how you have your data you can use a Pivot section.
    If the data is 1 row = 1 record then add computed column to your results with a static value of 1 and use that as your fact within the pivot with your Ticket Type as a top label and group as a side label.
    Wayne Van Sluys
    TopDown Consulting

  • Interactive Reporting - Multiple SELECT stmts in 1 query

    Is it possible to multiple/nested select statements in 1 query? Actually what I need to do is pull records for the last 12 months. The SQL that I'm basing my IR query from has multiple SELECT statements and uses the add_month function w/ a parameter ranging from 0 to -12.
    Thanks.
    Terri

    Here's some of the additional SELECTs. There are more after these that I didn't include since it would be fairly long.
    CREATE OR REPLACE VIEW DEFECT_INVENTORY
    (NEW_COUNT, CLOSE_COUNT, BEGINNING_COUNT, ENDING_COUNT, MONTHNAME,
    SEVERITY)
    AS
    select New_Count, Close_Count, Beginning_count, Ending_Count,r.Monthname, r.Severity from
    (select p.New_Count, q.Close_Count,p.sev Severity, p.Month_Name Monthname from
    (Select count(bg_bug_id) New_Count,a.Month_Name, a.sev
    from
    (select bg_bug_id,
    bg_severity sev,
    bg_user_10 app,
    bg_detection_date,
    bg_closing_date,
    to_date(bg_user_26, 'yyyy-mm-dd') as cancel_date,
    to_date(substr(bg_vts,1,10), 'yyyy-mm-dd') as vts,
    to_char(to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1, 'MON-YY') as Month_Name,
    bg_status,
    to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1 AS rpt_DATE_end,
    to_date((to_char(add_months(sysdate, -12), 'MM')||'/01/'||to_char(add_months(sysdate, -12), 'YYYY')), 'MM/DD/RRRR') AS rpt_DATE_beg
    from bug ) a
    where (a.bg_status not like '65-Cancelled'
    and a.bg_detection_date <= a.rpt_DATE_end
    and a.bg_detection_date >= a.rpt_DATE_beg
    and a.cancel_date is null)
    group by a.sev, a.Month_Name) p,
    (Select count(bg_bug_id) Close_Count,a.Month_Name, a.sev
    from
    (select bg_bug_id,
    bg_severity sev,
    bg_user_10 app,
    bg_detection_date,
    bg_closing_date,
    to_date(bg_user_26, 'yyyy-mm-dd') as cancel_date,
    to_date(substr(bg_vts,1,10), 'yyyy-mm-dd') as vts,
    bg_status,
    to_char(to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1, 'MON-YY') as Month_Name,
    to_date((to_char(add_months(sysdate, -12), 'MM')||'/01/'||to_char(add_months(sysdate, -12), 'YYYY')), 'MM/DD/RRRR') AS rpt_DATE_beg,
    to_date((to_char(add_months(sysdate, -11), 'MM')||'/01/'||to_char(add_months(sysdate, -11), 'YYYY')), 'MM/DD/RRRR') -1 AS rpt_DATE_end
    from bug ) a
    where (a.bg_status like 'Closed'
    and a.bg_closing_date <= a.rpt_DATE_end
    and a.bg_closing_date >= a.rpt_DATE_beg
    and a.bg_closing_date is not null)
    or
    (a.bg_status like 'Closed'
    and a.vts <= a.rpt_DATE_end
    and a.vts >= a.rpt_DATE_beg
    and a.bg_closing_date is null)
    or
    (a.bg_status not like 'Closed'
    and a.bg_closing_date <= a.rpt_DATE_end
    and a.bg_closing_date >= a.rpt_DATE_beg
    and a.bg_closing_date is not null)
    group by a.sev, a.Month_Name) q
    where p.sev = q.sev) r,

  • Referencing a row level field value in an Interactive Report using jquery

    I have an Interactive Report with a row level select_list:
    select ename "Employee Name",
    mgr "Manager",
    empno,
    APEX_ITEM.SELECT_LIST(
    p_idx => 3,
    --p_value         =>   deptno,
    p_list_values => 'Copy;Copy,Delete;Delete,Export to PDF;Export to PDF',
    --p_attributes    =>   'style="color:red;"',
    p_show_null => 'YES',
    p_null_value => NULL,
    p_null_text => '--Select--',
    --p_item_id       =>   'f03_#ROWNUM#',
    p_item_id => 'P6_IR_SELECT_LIST',
    p_item_label => 'Label for f03_#ROWNUM#',
    p_show_extra => 'YES') "Actions"
    from emp e, dept d
    where e.deptno = d.deptno ;
    When a user selects "Delete", i'd like to delete the EMPNO based on the row where the user selected "Delete". I have tried alerting on the following, but cannot figure out how to capture the row-level EMPNO:
    alert($v('apexir_EMPNO'));
    alert($('#apexir_EMPNO').val());
    Can someone tell me how to reference the specific EMPNO per row?
    Thanks in advance!
    John

    What about this:
    Dynamic action
    Event: change
    selector: jQuery selector:
    select[name="f21"]
    True action
    Exec JS code
    var row = $x_UpTill(this.triggeringElement, 'TR');
    var otherElement = $('input[name="f20"]', row)[0];
    console.log(otherElement.value);
    http://apex.oracle.com/pls/apex/f?p=45448:11 (bottom half)

  • Interactive Report row filter item aliases

    When trying to use row filtering on an interactive report that selects over 100 items, the aliases are alphabetic for the report columns but once they get as high as FZ they stop and are all aliased as \\ and become unusable. Is this a limitation in the IR?? Has anyone gotten around this???
    Thanks,
    Andrew

    Jeff,
    Thanks again for the response and for looking into it. However, if I am not mistaken, the url in that excerpt does the same thing as the URL I posted except that you used IREQ_COLNAME instead of IR_COLNAME (which defaults to EQ I believe).
    I want to see if a value is in column a OR column b, etc. The "OR" is the all important caveat.
    I would settle for being able to pass a value to the IR's main search box (that searches all columns of all rows) if I cannot do a targeted row level filter on a few select columns.
    If anyone knows how to do either of those things, that would be great information to have.
    Thanks,

  • Tabular form validation(Checkbox) is not working for Interactive report

    Hi,
    I am using the oracle apex 4.0 and oracle 11g.
    I have written a below select query on interactive report as
    select
    apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
    apex_item.text(3,RESNUM) as resnum
    from "PDRRES"
    and written the validation to display the error message( Function returning error text ) as
    DECLARE
    vRow BINARY_INTEGER;
    BEGIN
    -- apex_application.g_print_success_message := NULL;
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    vRow := apex_application.g_f01(i);
    apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
    END LOOP;
    END;
    Output : No data found error message
    As far as it work for sql report with above logic because apex built in row selector
    but it fails in case of interactive report for some reason.
    Please suggest.

    Saroj Nayak wrote:
    Hi,
    I am using the oracle apex 4.0 and oracle 11g.
    I have written a below select query on interactive report as
    select
    apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
    apex_item.text(3,RESNUM) as resnum
    from "PDRRES"
    and written the validation to display the error message( Function returning error text ) as
    DECLARE
    vRow BINARY_INTEGER;
    BEGIN
    -- apex_application.g_print_success_message := NULL;
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    vRow := apex_application.g_f01(i);
    apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
    END LOOP;
    END;
    Output : No data found error message
    As far as it work for sql report with above logic because apex built in row selector
    but it fails in case of interactive report for some reason.
    Please suggest.NO DATA FOUND usually occurs when an i mplicit select does not find anything. It can also occur when referencing a collection element that has not been defined.
    You have 2 collectinons in the code you posted, apex_application.g_f01() and apex_applciation.g_f03. Since you are looping therough the COUNT attribute of g_f01 its reference ("I") is probably okay and the value store in vRow is probably not right. You can check this by using RAISE_APPLICTION_ERROR to see the value something like
    raise_application_error(-20000,'vRow="'||vRo2||'"');Remember that working with checkboxes is tricky. If the box is not checked nothing will be sent. You may need to define a default value when no value is submitted.

  • Button in Interactive Report

    Hi Friends,
    I want to add Button in Interactive report for each row. Is it possible to add a button.Please help me.

    You should add a dummy column in your report query. Make dummy column as a link and change the column attribute 'Column Link' to and image. For instance the Edit column in the following query is a button on my report.
    select
    'Edit',
    "CUST_NO",
    "CUST_FIRST_NAME",
    "CUST_LAST_NAME",
    "CUST_ADDRESS",
    "CUST_CONTACT_PHONE_NO"
    from "CUSTOMER"

  • Making raw breakes in Interactive report

    Hello
    I have build an application, which is a grading system - it is going to be used for a competition.
    In the main page of the application, I have an interactive report with all of the competitors, which are ordered by the highest marks they get.
    The top six competitors are going to the next round of the competition.
    I need to separate the first 6 rows of the report, from the rest of the report.
    Is it possible to make a break after the first 6 records of the interactive report? May be by modifying a select statement?
    Thank you for consideration.

    Wow, it's getting harder and harder to read posts here. People seem to be very casual with their writing. I don't know if it's because the forum is multi-national or people have gotten used to "IM-speak" or what.
    I'm just saying... How do people expect others to want to answer their question if they don't put in the time to ask it so it can be comprehended?
    Sorry, that was my rant for the day.
    As for answering your question, you would need to change your report query to add a column like this:
    row_number() OVER(ORDER BY competitor_score DESC) AS score_rank
    If you simply want to highlight those who go to the next round, customize the Interactive report to highlight rows where the score_rank <= 6.
    If you want the IR to to Group By, customize the IR to create a calculation, where if the score_rank <= 6, then "Move Forward", otherwise "Going Home". Then have the IR group by that new column. Or enhance your SQL query to do it. Something like this should work:
    SELECT d.*,
    CASE
    WHEN d.score_rank <= 6 THEN
    'Move Forward'
    ELSE
    'Going Home'
    END AS progress_groups
    FROM (SELECT ...,
    ROW_NUMBER() OVER(ORDER BY competitor_score DESC) AS score_rank
    FROM ...) d;
    Good luck,
    Stew

  • Manual Tabular Form Generation in Interactive Reports

    Dear All;
    I used the following statement to generate a tabular form in an interactive report region;
    SELECT
    id No,
    apex_item.text(1,C1,3,4, ,'f01_#ROWNUM#') C1
    from test_table
    The no of items on the form depends on the number of rows in test_table. However, I am unable to reference the individual cells in the form. it turns out apex is using the same id for each row( f01_#ROWNUM#) in the generated source code and is not substituting rownum for the row number (eg. f01_1 for first row, f01_2 for second row generated in a normal report template). Is there something I'm doing wrong or is this a bug? I am running on apex 4.0.1
    Any assistance will be greatly appreviated.
    Benedict.
    Edited by: Zulu on Sep 11, 2010 2:16 PM
    Edited by: Zulu on Sep 11, 2010 2:29 PM

    Hi Trent,
    It is working fine now... " You have saved my life and I am eternally grateful" :-) .
    Br,
    Benedict.
    Edited by: Zulu on Sep 12, 2010 7:44 AM

  • Interactive Report: collection not limited to screen?

    Hi,
    My problem: I want to use the selection made in an interactive report and put that into an APEX collection. BUT I do not want it to be limited to the rows shown on the screen.
    For instance: if a user makes a selection with his interactive report of 2000 rows, the screen only shows for instance the first 50. I want the id's of the all the 2000 rows, so I can make a fixed report to be exported out of that.
    Is it possible to obtain the collection that the interactive report uses?
    Any help is appreciated...

    Hi lilhelp,
    If you dont want to show the report defaultly then, restrict your region source query of the report with some filter page items in your WHERE clause.
    Brgds,
    Mini
    Mark Answers Promptly

Maybe you are looking for