Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » multiple rows select in interactive grid using FOR LOOP (Application Express 21.0)
multiple rows select in interactive grid using FOR LOOP [message #689109] Sun, 24 September 2023 07:42 Go to next message
hissam78
Messages: 193
Registered: August 2011
Location: PAKISTAN
Senior Member
Dear Experts,
we Need to show multiple rows in interactive grid using FOR LOOP.
somebody can help please? how to define the code please.

Thankful
Re: multiple rows select in interactive grid using FOR LOOP [message #689110 is a reply to message #689109] Sun, 24 September 2023 11:48 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Apex <> Forms.

In Forms, you'd write a trigger which loops through some data source and puts values into block fields. I don't see a point in doing that in Apex's Interactive Grid. Why would you want to do that? Interactive Grid works best in a (let's just call it) MS Excel mode, where you can view and edit data directly on the same page (as opposed to combination of Interactive Report + Form). That also means that Apex automatically generates process which handles modifications to the grid.

You could - for example - create a collection, a view on that collection, instead-of trigger (to handle modifications), your own Apex DML process and see what will turn out of that. I never tried it so I can't offer any suggestion based on my own experience, but - if I were you - I'd think twice whether that's something I'd really want to do, or switch to something else which is natively supported by Apex and - thus - simpler to implement and use.
Re: multiple rows select in interactive grid using FOR LOOP [message #689138 is a reply to message #689110] Thu, 28 September 2023 03:50 Go to previous messageGo to next message
hissam78
Messages: 193
Registered: August 2011
Location: PAKISTAN
Senior Member
Thanks for reply Dear Littlefoot,
Actually we want to fetch rows on Button click and populate in Interactive grid using loop, because there are more than one records to populate for example we need to populate the number of products or items  with UOM, qty and rate from another table.
therefore I requested.

Thankful..
Re: multiple rows select in interactive grid using FOR LOOP [message #689163 is a reply to message #689138] Fri, 29 September 2023 01:36 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK.

So, you have two tables: one that already contains rows you need, and another one which will "accept" rows from the 1st table. The 2nd table is (I presume) base table for the interactive grid region.

How about the following approach?
  • create a button (let's call it P1_BTN_COPY)
  • create a process which will "copy" data from one table to another; I presume that there should also be some page items which will help in identifying rows that should be copied. Process should fire only when P1_BTN_COPY is pressed
  • write code which does that, e.g.
    insert into table_2 (id, name, address, amount) 
    select id, name, address, amount
    from table_1
    where code = :P1_CODE
      and year = :P1_YEAR;
  • submit would refresh the page and cause interactive grid to be populated; make sure to include appropriate WHERE clause in grid's properties, otherwise you'll get all rows from the 2nd table, and that's probably not what you want
Re: multiple rows select in interactive grid using FOR LOOP [message #689261 is a reply to message #689163] Wed, 01 November 2023 00:22 Go to previous messageGo to next message
hissam78
Messages: 193
Registered: August 2011
Location: PAKISTAN
Senior Member
Thanks a lot Littlefoot, grateful for help.

[Updated on: Wed, 01 November 2023 00:23]

Report message to a moderator

Re: multiple rows select in interactive grid using FOR LOOP [message #689265 is a reply to message #689261] Wed, 01 November 2023 11:59 Go to previous message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You're welcome.
Previous Topic: Create Report in Apex Oracle CLoud
Next Topic: Parse CSV file from shared folder
Goto Forum:
  


Current Time: Sat Apr 27 08:47:15 CDT 2024