Problems looping selected rows in a report

Hi,
I have a report on my form, of type SQL Query (updateable report), that I populate using the following SQL:
SELECT APEX_ITEM.CHECKBOX(1,prvidd,'CHECKED') " ", prvidd, prvnme, prvlev
FROM vu_roleprivs
WHERE rolidd = :P32_ROLIDD
The first two columns are hidden, so that when it comes to inserting/updating then all rows will be processed (this is a requirement).
I use the following process to loop through the report rows...
DECLARE
vROW VARCHAR2(4000);
prvIDD NUMBER;
prvLEV VARCHAR2(3);
BEGIN
FOR i IN 1..APEX_APPLICATION.G_F01.COUNT
LOOP
vROW := APEX_APPLICATION.G_F01(i);
prvIDD := APEX_APPLICATION.G_F02(vROW);
prvLEV := APEX_APPLICATION.G_F04(vROW);
-- Delete the current row from PDROLPRV
DELETE FROM pdrrolprv WHERE rolidd1 = :P32_ROLIDD and prvidd1 = prvIDD;
-- Now insert the record from the table row
INSERT INTO pdrrolprv VALUES(:P32_ROLIDD, prvIDD, prvLEV);
END LOOP;
END;
... but when the process runs I get the following error:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
I can't see where I am going wrong - can anyone help, would be much appreciated.
Best regards
Simon

Hi Simon,
This might be stating the obvious, but first up I would determine exactly where the code is failing by putting dummy values instead of variables into the following statements: -
DELETE FROM pdrrolprv WHERE rolidd1 = :P32_ROLIDD and prvidd1 = prvIDD;
INSERT INTO pdrrolprv VALUES(:P32_ROLIDD, prvIDD, prvLEV);
Assuming the code then runs correctly, start putting your variables back 1 by 1 until you find the failure. You might also want to dump out your variable values: -
vROW := APEX_APPLICATION.G_F01(i);
prvIDD := APEX_APPLICATION.G_F02(vROW);
prvLEV := APEX_APPLICATION.G_F04(vROW);
to a test table.
Hope that helps. Give me a shout if you're still having trouble.
Mike

Similar Messages

  • How to reference the selected row on a report by click a radiobox

    I created a report with a column displayed as a radiobox.The report source is like "select htmldb_item.radiogroup(1,.....),rec_id,....from .... where ....",after click one radiobox,i want to get other column's value in the selected row in the after submit process ,can anyone help me?????? how to reference "rec_id" of the selected row?

    Hello,
    First, please tell us your first name, and update your forum handle. It’s make it easier to track your threads, and help you.
    >> apex_application.g_f01(1)" only return the first record's rec_id,if i click radiobox in other rows,it returns the same result as click radiobox in the first row?
    The ‘G_F01’ is an array of values, so apex_application.g_f01(1) will always bring you the first element of this array. If you want to retrieve other values from this array, which will include the values of the radiogroup value of the other lines, you need to use a loop. Something like that should work:
    for i in 1.. apex_application.g_f01.count loop
    … apex_application.g_f01(i) …
    end loop;
    >> after click one radiobox,i want to get other column's value in the selected row in the after submit process
    That means that the value of your radiogroup item should include some indication to the line you are on. If, like in Andy’s example, you can retrieve your record from a table, based on a PK, your radiogroup can return this kind of information. However, if the data on the other columns of the select raw, were just entered/updated by the user (like in a tabular form), the radiogroup item should include information about the row you are in, in order for you to be able to access the corresponding array elements – other G-Fxx arrays – of the other columns in the row. In this case, I believe using checkboxes is preferable.
    Regards,
    Arie.

  • Highlighting currently selected row in a Report-Form page

    Hi,
    I have a page with Report - Form layout. On the top of the page there is a classical report (not IR). When the user click a row then I display a detail form below it. It would be nice if I could highlight the row the user clicked last time, to indicate to which row the detail data below the report belongs to. Did any body do something similar?
    Regards, Tamas

    It's relatively simple to achieve this—without JavaScript—using a named column report template and CSS:
    http://apex.oracle.com/pls/apex/f?p=34839:27:0
    We'll assume a page item (or items) already exists for receiving the master row primary key value(s). In the example this is P27_DEPTNO. Give the master report region a static ID for use in CSS selectors. Here this is department.
    If the master primary key value(s) are used as links in the report, then [column link] columns need to be created to replace them in the report attributes.
    Create a named column report template as required by your report query, including an HTML ID attribute for the report row element that contains column references to the primary key value(s). Replace column references in the row template for any primary key link columns with the [column link]s created previously. In the example, [column link] (ref #4#) replaces DEPTNO (ref #1#) as we need to reference the original DEPTNO value in the row ID:
    Row Template
    <tr id="dept-#1#">
      <td class="t17data">#4#</td>
      <td class="t17data">#2#</td>
      <td class="t17data">#3#</td>
    </tr>We then just need to use the selected P27_DEPTNO value via substitution in a page HTML Header to create a descendant selector that will apply a highlight to the cells in the currently selected row (along with some others to make it easier to select the row):
    CSS
    <style type="text/css">
    /* Make the whole table cell a link target */
    #department td {
      padding: 0;
    #department td a:link {
      display: block;
      padding: 2px 8px;
    /* Universal Selector sucks */
      font-size: 9pt;
    /* Highlight the selected row */
    #department tr#dept-&P27_DEPTNO. td {
      background-color: #eee;
    </style>

  • Loop Through Rows in SQL Report.

    Hello Everyone,
    I've been creating a very different application, and I've run into quite the roadblock.
    Let me give you a breif about the problem.
    I have a form that needs to be dynamic and thus is created at runtime.
    I have used the APEX_ITEM and a SQL SELECT CASE to create a dynamic report.
    For example if the DATATYPE column in my table says DATE, I create an APEX_ITEM.DATE_POPUP, if it says CHAR i create a textbox, and if a column called
    LOV is populated APEX_ITEM.SELECT_LIST_FROM_QUERY using the number value of the LOV to query a List of Values from another table.
    Now this brings me to say in a single column of the there could be different data_types. meaning the multi-row update functionality with apex will not work.
    Getting the data to display is easy. However saving the updates is a different story.
    Which brings me to my question. Does anybody know of way in which you can loop through each row in a SQL Report on APEX and assess each row individually.
    I'd like to accomplish something like this
    LOOP
    MyUpdateProcedure(currentrow_id,currentrow_datatype, currentrow_value)
    Go to Next Row in Report
    END LOOP;
    Pretty simple in theory? Do we have an APEX expert out there who could give me a hand with this?

    Codes,
    It sounds to me like you could add a hidden field to tell you what you need to know in order to determine the column to update.
    Assuming it was created using the parameter p_idx = 50 and contained the names you provided (eg DATA_DATA) and your primary key is created using p_idx = 1 then you could add the logic for the update into an on submit process something like so
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    CASE apex_application.g_f50(i)
    WHEN 'DATA_DATA' THEN
    -- run the update against the data column
    WHEN 'CHAR_DATA' THEN
    -- run the update against the char column
    etc.
    If the multi-type column is created with the apex_item api using p_idx = 2 then you just refer to it in the loop as apex_application.g_f02(i) and the primary key is apex_application.g_f01(i).
    I hope this helps.
    Greg

  • How can I get the values of the selected row in the report?

    Hi All:
    I have a dynamic query(lexical parameters)that columns are selected at the run time. And depend on the values, I'd like to do another query just for certain row. For example, when I double click on the fifth column of the fifth row. I'd like to collect all the column values of this fifth row. I think It likes drill-down report, but I don't need a detail report. I just want a string of the combination column's values. Would you please help?
    Thanks, in advances, for your help.
    TD

    Hi:
    I got it.
    Thx,
    TD

  • Problem in selecting rows in ALV Grid

    Hi All,
    I am doing a ALV Grid program using Classes. when i select 2 rows from that grid and executes,
    it going next screen. Again when  i am using back button and selecting same rows or different rows from teh same Grid and executing it is not retrieving any rows. In dedugger it is showing that the there is no selection of rows.
    Please suggest me the solution.
    Thanks in advance,
    Regards,
    Balaji.

    Hi chaitanya,
    I am not clearing any code.
    please find the code...
    CALL METHOD g_grid1->get_selected_rows
            IMPORTING
              et_index_rows = w_lvc_t_row_1.
          IF w_lvc_t_row_1 IS INITIAL.
            MESSAGE e004(zmsg).
          ELSE.
            CLEAR it_memis1-signal.
            REFRESH po_memis1.
            LOOP AT w_lvc_t_row_1 INTO w_lvc_s_row_1.
              READ TABLE it_memis1 INTO po_memis1 INDEX w_lvc_s_row_1-index.
              SELECT SINGLE name INTO v_nam FROM icon WHERE id = po_memis1-signal.
              IF v_nam = 'ICON_LED_GREEN' OR v_nam = 'ICON_LED_YELLOW'.
                APPEND po_memis1.
                CLEAR po_memis1-signal.
              ELSE.
                MESSAGE 'This item Cannot be processed due to errors' TYPE 'E'.
              ENDIF.
            ENDLOOP.
          ENDIF.
    regards,
    Balaji.

  • Master/detail and problem with selected row when errors on detail row

    I'm using JDeveloper 10.1.3.3
    I have a very simple master/detail screen (JSF JSP) where master is departments and detail is employees in the selected department. Some of the attributes in employees are required.
    To department A
    I take away the value of one of the required attributes of one of the detail employee rows.
    Select one of the other departments ie department B
    Get Error message Value required.
    So far so good, but the selected department is B and the detail rows shown is for department A.
    I expected that department A to still be selected or that department B with its row to be shown.
    Edited by: user628847 on 26.feb.2009 04:55

    Hi,
    if (row != null)
    Row masterRow = row;
    vo.setCurrentRow(masterRow);
    // not needed : getMesReponsesPourTiersVO1().executeQuery();
    You shouldnot execute the child VO after setting current row in master VO.
    When the current row is set in master VO, then the child rows will get refreshed automatically.
    Cheers,
    Prasanna

  • Problem in selection screen of y-report.

    Hi ALL,
    I have modify a y-report and add one parameter to selection screen. Earlier there was only two parameter, now it becomes three. In developement and quality servers it is showing all three parameters and report is running perfectly OK. But when I traport it into production server, third parameter which I added later is not showing, only old one is showing. But when I see the code in production server then in code it is showing that third parameter but when I execute report then only two are showing. Wht shd I do? Kindly suggest.
    Regards,
    Rajesh Vasudeva

    Hi Rajesh,
    You are saying that new selection parameter has been added while you add the parameter in the report at that time when you are saving the request number to which you have assign has to be transported then only it works.
    And it is showing in the QAS since the previous request which is been created for 2 parameters might be present in the QAS and the same transported to PRO check back the transport request will resolve your issue.
    Cheers!!
    VEnk@

  • Loop in a report select rows  ???

    Hello,
    I have an updatable report with a column row selector (the column is in the first position and it is shown).
    I want be able to loop over the select rows in a report in order to do some pl/sql, this pl/sql has to be executed only when the user select a row.
    The problem is wwv_flow.g_f01.count : gives the number of selected rows, but don't allow me to loop the selected rows.
    How can I specify to htmdldb to loop in all the selected rows.
    Jina.

    for i in 1..wwv_flow.g_f01.count loop
    reference the selected value as wwv_flow.g_f01(i)
    end loop;
    typically you would store the primary key as the selected value.

  • Want to update multiple rows of the report but getting a bug.

    hi,
    I am trying to update multiple rows of a report.For that I have created a teport with dynamic checkbox generated using ---HTMLDB_ITEM.CHECKBOX(1,utt.trouble_ticket_id) " "----.Checkboxes are rendered perfectly on the report.
    but when I tried to update the selected rows of the report as given in the documentation
    begin
    :P16_priority:=htmldb_application.G_F01.count;
    for i in 1..htmldb_application.G_F01.count
    loop
    update umanage_trouble_ticket set severity =:P16_priority where
    trouble_ticket_id = htmldb_application.G_F01(i);
    end loop;     
    end;
    I found that all the rows are updated.not only selected rows.
    and the count it gives =no of rows returned + no of rows selected.
    Please help me regarding this.
    thanx.
    BHARAT

    Hi Bernhard,
    I think that u didnt get y problem.
    When I take the value from "htmldb_application.g_f01(i)" then it should return id's of rows that are checked but when I do that it returns id's of all the rows.So I am not able to update only checked rows.
    from id's of rows i mean value provided when generating checkboxes through query.
    htmldb_item.checkbox(1,trouble_ticket_id) " "
    I am approching to the solution as specified in the documentation. "Adding check boxes to each row in a report".
    but still cant find any solution.
    thanx that u showed some intrest in my problem.
    If u can get the solution reply soon.
    Regards
    BHARAT

  • How to highlight selected  row in a region ? ? ?

    Hi There!
    I have two regions Region1 and Region2. Region2 data is populated when I select a row in Region1.
    Now I have Region1 and Region2 data on the same page, but I cant exactly tell which row in Region1 corresponds the data in Region2.
    I was thinking of highlighting the row which was selected in Region1. Went through couple of solutions, but wasnt able to implement it.
    So was wondering if any one of you know a easy to understand and implement a solution for this problem.
    Any help or suggestions is greatly Appreciated.
    Thank you
    Krishna

    Hi krishna,
    You can try this
    http://roelhartman.blogspot.com/2009/06/highlight-row-in-interactive-report.html
    and examples
    http://apex.oracle.com/pls/otn/f?p=ROEL:CURROW:763487747488998
    http://apex.oracle.com/pls/apex/f?p=34839:27:0
    or try solutions from this thread
    Highlighting currently selected row in a Report-Form page
    hope this will help you
    regards,
    Chetan
    Edited by: Chetan on 24 May, 2010 12:44 PM
    Edited by: Chetan on 24 May, 2010 12:45 PM

  • Select row and column from header in jtable

    hello i have a problem to select row and column from header in jtable..
    can somebody give me an idea on how to write the program on it.

    Hi Vicky Liu,
    Thank you for your reply. I'm sorry for not clear question.
    Answer for your question:
    1. First value of Open is item fiels in Dataset2 and this value only for first month (january). But for other month Open value get from Close in previous month.
    * I have 2 Dataset , Dataset1 is all data for show in my report. Dataset2 is only first Open for first month
    2. the picture for detail of my report
    Detail for Red number:
    1. tb_Open -> tb_Close in previous month but first month from item field in Dataset2
    espression =FormatNumber(Code.GetOpening(Fields!month.Value,First(Fields!open.Value, "Dataset2")))
    2. tb_TOTAL1 group on item_part = 1
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)))
    3. tb_TOTAL2 group on item_part = 3 or item_part = 4
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) + ReportItems!tb_TOTAL1.Value )
    4. tb_TOTAL3 group on item_part = 2
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) - ReportItems!tb_TOTAL2 .Value)
    5. tb_Close -> calculate from tb_TOTAL3 - tb_Open
    expression =FormatNumber(Code.GetClosing(ReportItems!tb_TOTAL3.Value,ReportItems!tb_Open.Value))
    I want to calculate the value of tb_Open and tb_Close. I try to use custom code for calculate them. tb_close is correct but tb_Open is not correct that show value = 0 .
    My custom code:
    Dim Shared prev_close As Double
    Dim Shared now_close As Double
    Dim Shared now_open As Double
    Public Function GetClosing(TOTAL3 as Double,NowOpening as Double)
        now_close = TOTAL3 + NowOpening
        prev_close = now_close
        Return now_close
    End Function
    Public Function GetOpening(Month as String,NowOpen as Double)
        If Month = "1" Then
            now_open = NowOpen
        Else    
            now_open = prev_close
        End If
        Return now_open
    End Function
    Thanks alot for your help!
    Regards
    Panda A

  • Changing colour of selected row to orange

    Hi,
    I have requirement that selected row of the table should be highlighted in orange colour.
    Currently, my table selection and associated events are working fine.
    Only problem is selected row is not getting highlighted.
    Can anyone tell me which property of the table I should modify?
    Thanks in advance,
    Apurva

    Hi Ayyappa,
    The selectionMode of the table is auto. I have created an action HighlightRow and this action is getting called on the event onLeadSelection. I have placed the code given by you in the Action.
    However, the row is not getting highlighted.
    What am I missing.
    Nikhil

  • Allow user to select rows

    Is there any way we can allow Users to select rows in a report so that they can print the details present for that report from an underlying details sub-report?
    Dhananjay Rele

    It is possible but might prove unscalable. SSRS reports provide 3 mechanisms for handling click events.
    Hyperlinks. You can format text placeholders to interpret basic HTML, including hyperlinks.
    Action. Most SSRS controls have an Action property that has 4 possible methods to handle the click event: None (ignore, default behavior), Go to report, Go to bookmark, Go to URL.
    Visibility (Display can be toggled by this report item). You can specify another report control that, when clicked, toggles the visibility of this report control.
    The first 2 might be used to reload the current report with updated parameter settings. For instance, I create a parameter called @PrintThis. When I click a row in a tablix, I am clicking on a textbox in one of the colloumns of that row. I can set the action
    property of that text box to open the current report, passing all the same parameter values in except that I set @PrintThis to @PrintThis+";"+Fields!MyCell.Value. This parameter is used to display the details of the row I clicked plus any previously clicked
    rows. With this approach, you would need a text box with the action property set to pass "" to @PrintThis so the user can clear that property to start over. Or set up a table that displays each value of the @PrintThis parameter with the action property set
    to remove that value from @PrintThis (@PrintThis = Replace(@PrintThis, Fields!ClickedCell.Value+";","")).
    The 3rd option could be used if the report already has a separate details subreport embedded for each row in the main report's tablix with it's Visibility set to Hide and with "Display can be toggled by this report item" set to the appropriate row's clickable
    cell. It will likely take longer to run the report initially but the toggling of the subreports is near instantaneous. Using Action or hyperlink will be quicker initially but each click will have a similar delay to the initial report rendering.
    So this will include certain details as determined by the "clicks" a user selects
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • How to select multiple row in ALV report

    Hi friends,
    1. How to select multiple row in ALV report
                   ( How to set tab in ALV report and want to select multiple line.)
    Thanking you.
    Subash

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

Maybe you are looking for