2 Replies Latest reply: Apr 2, 2013 6:08 AM by 908320 RSS

    Checkboxes in a report

    genache
      Hey all.
      I'm an Apex noob, but i desperately need some guidance.
      i have a table called "Employees" and based on that i have a report. When i select one of the employees, i created a report that shows all the inventory that that employee has. The source for report is this:
      select
      apex_item.checkbox(1,assetid,'UNCHECKED') " ",
      apex_item.text(2,asset_tag) "Asset tag",
      apex_item.text(3,shortdescription) "Short description",
      apex_item.text(4,serial_number) "Serial number",
      apex_item.text(5,service_tag) "Service tag"
      from products
      where id=:p26_id

      i have also an apply button with a process with this code:
      BEGIN
      FOR i in 1..APEX_APPLICATION.G_F01.COUNT
      LOOP
      INSERT INTO inventory_dummy
      (assetid, asset_tag, shortdescription, serial_number, service_tag)
      VALUES
      (htmldb_application.g_f01(i),
      htmldb_application.g_f02(i),
      htmldb_application.g_f03(i),
      htmldb_application.g_f04(i),
      htmldb_application.g_f05(i));
      END LOOP;
      COMMIT;
      END;

      So all it suppose to do is to take whatever records I check from my initial report and to insert those records in a dummy table which i can use later.
      It's a bit obvious what's my mistake (if I select any 3 records in report, it will copy in the dummy table the first 3 records from my report).

      But I'm confuse and I can't figure out how else could i do it.

      Please help.

      Thank you.
      Best regards!
        • 1. Re: Checkboxes in a report
          scott.wesley
          Super common but highly annoying problem.

          The checkboxes are stored densely in the array, where all other values end up in a sparse array.

          So typically you store the ID value in the checkbox, and process array based on list of IDs, not positional.
          Or you pre-process your checkbox array to match the rest of them.

          Sorry for lack of coding examples, but hopefully that will get you going. Plenty of examples about the place - check out Denes Kubicek's sample application.
          • 2. Re: Checkboxes in a report
            908320
            Hi,

            would you please check below, i think you can have good idea about it.

            (link removed by moderator)

            Thanks.

            Edited by: BluShadow on 02-Apr-2013 12:07
            linking to promote your own blog is a breach of the Terms of Use of the forums