8 Replies Latest reply: Feb 29, 2012 10:04 AM by Jitendra RSS

    Adding radio button to each row of an interactive report: possible or not?

    920172
      First of all let me explain what the point of this application is.
      I'm making an application that allows a user to select something out of a drop-down select list. This list is a list of categories for food. Let's say the user selects "Fruit".
      Then the page refreshes and shows an interactive report with a list of food that belongs to the category of fruit.

      Here's where I want to change things:
      I want the user to see the interactive report, but in this interactive report I want to add a radio button for each row.
      Then, when a certain type of food is selected (let's say "Strawberry") via the radio button, a text field should appear underneath the interactive report. In this textfield, the user can then add the weight of the food item, and then it will calculate how many carbs there are in the strawberry.

      All I really want to know is:*
      How do I add a radio button to each row of the interactive report, and how do I link this radio button to the value of that particular row?*



      Additional information:
      The item "P17_FOOD_CATEGORY" contains the following LOV:
      select FOODCATEGORYNAME as display_value, FOODCATEGORYID as return_value
      from FOODCATEGORY
      order by 1

      The "Food" region contains the following source:
      select a.FOODID, a.NAME, b.FOODCATEGORYNAME, c.STANDARDAMOUNT, c.NAME Unit
      from FOOD a inner join FOODCATEGORY b
      on a.FOODCATEGORYID = b.FOODCATEGORYID join FOODUNIT c
      on a.FOODID = c.FOODID
      where a.FOODCATEGORYID = :P17_SET_CATEGORY

      EDIT:
      PLEASE! Even if you don't know a good answer or if you are unsure about your answer, do post! Even suggestions would be welcome! I really need all the help I could get, even if it's not much.

      Edited by: 917169 on Feb 29, 2012 12:25 AM
        • 1. Re: Adding radio button to each row of an interactive report: possible or not?
          chrissy2
          Hello user 917169 (that's really unpersonally, I name woould be nice),

          I think using APEX_ITEM.CHECKBOX and javascript would do the trick (you can find description in the help files)
          Using APEX_ITEM will create a input elements which you can access in javascript. So you can add an onclick event to the checkbox an handle it in javascript, to show the textbox for the weight.

          Hope this helps for the start, if you need more information just let us know.

          chrissy
          • 2. Re: Adding radio button to each row of an interactive report: possible or not?
            Jitendra
            Hi ,

            yes it is possible to have radio button for each row in interactive report.
            i am just modifying your code

            step 1:
            select  apex_item.radiogroup(1,a.FOODID), a.NAME, b.FOODCATEGORYNAME, c.STANDARDAMOUNT, c.NAME Unit
            from FOOD a inner join FOODCATEGORY b
            on a.FOODCATEGORYID = b.FOODCATEGORYID join FOODUNIT c
            on a.FOODID = c.FOODID
            where a.FOODCATEGORYID = :P17_SET_CATEGORY
            step2:

            go to report attributes then change display as text of foodid column to standard report column.

            This will give you radio button for each row in interactive report.

            Thanks,
            Jitendra
            • 3. Re: Adding radio button to each row of an interactive report: possible or not?
              920172
              Hi there!

              I tried to change my code to your version, but then I get an error message:

              Error Unable to change Interactive Report query.
              ORA-12899: value too large for column "APEX_040100"."WWV_FLOW_WORKSHEET_COLUMNS"."DB_COLUMN_NAME" (actual: 32, maximum: 30)

              I don't quite know what this means. After doing a quick search on the internet, I know that this message should mean that the length of the value for the columns named "APEX_040100", "WWV_FLOW_WORKSHEET_COLUMNS" and "DB_COLUMN_NAME" is too long. But, I don't have these columns. I searched for them in my object browser, and they can't be found in any table related to my application.

              I'm sure your answer is the solution, but do you perhaps have an idea on how to solve this error? I checked the allowed maximum length for any column value that is related to my application, but they all have "50" set as the maximum value...


              Thank you for your reply. ;)
              • 4. Re: Adding radio button to each row of an interactive report: possible or not?
                Jitendra
                Hi,

                I got the problem you are getting,

                >
                Error Unable to change Interactive Report query.
                ORA-12899: value too large for column "APEX_040100"."WWV_FLOW_WORKSHEET_COLUMNS"."DB_COLUMN_NAME" (actual: 32, maximum: 30)
                >
                you are getting this problem because size of this apex_item.radiogroup(1,a.FOODID) is more than 30 characters, but we have some restriction for column names,we cant use more than 30 characters for column names ,so for this use allias for column name, please see the below modified code.

                select  apex_item.radiogroup(1,a.FOODID) as "FOODID", a.NAME, b.FOODCATEGORYNAME, c.STANDARDAMOUNT, c.NAME Unit
                from FOOD a inner join FOODCATEGORY b
                on a.FOODCATEGORYID = b.FOODCATEGORYID join FOODUNIT c
                on a.FOODID = c.FOODID
                where a.FOODCATEGORYID = :P17_SET_CATEGORY
                Hope this will helps you,

                Thanks,
                Jitendra
                • 5. Re: Adding radio button to each row of an interactive report: possible or not?
                  920172
                  Thank you! It did help! :) No more error.

                  But I do have a different issue now. Instead of a radio button, this appears in the interactive report:
                  *<input type="radio" name="f01" value="7" />*

                  It's the same for every row, with the only difference being the number of the value.
                  Any idea?


                  Thank you in advance, you've been a great help to me. :)


                  Regards,

                  Magali
                  • 6. Re: Adding radio button to each row of an interactive report: possible or not?
                    Jitendra
                    Hi,

                    >
                    But I do have a different issue now. Instead of a radio button, this appears in the interactive report:
                    <input type="radio" name="f01" value="7" />
                    >

                    just go to page definition then go to report attributes by clicking on interactive report link
                    and then change display as text of foodid column to standard report column.


                    this will give you radio button.

                    Thanks,
                    Jitendra
                    • 7. Re: Adding radio button to each row of an interactive report: possible or not?
                      920172
                      I did, but it still shows *<input type="radio" name="f01" value="7" />* instead of a radio button.

                      When I click the column header of the interactive report, I see the buttons to sort ascending, sort descending, hide column, control break and edit. But I also see a search box, and underneath that part, instead of the values of the foodid I see radio buttons.

                      So, it knows it's a radio button (since they're shown when clicking the foodid column header), but they're not displayed in each row.

                      Edited by: 917169 on Feb 29, 2012 4:33 AM
                      • 8. Re: Adding radio button to each row of an interactive report: possible or not?
                        Jitendra
                        Hi,

                        I think you are missing something,

                        Go to page definition and do the following

                        1. Go to report attributes

                        Where you found all the columns having thier headings,type,link and Display as text

                        2. Change "Display Text As" to Standard Report Column.

                        you have created radio button on FOODID,so for FOODID column Change "Display Text As(escape special character)" to Standard Report Column.

                        and then click on apply changes.


                        This is the solution,

                        Hope this will solve your problem,

                        Thanks,
                        Jitendra