Forum Stats

  • 3,872,750 Users
  • 2,266,468 Discussions
  • 7,911,293 Comments

Discussions

Interactive Grid, Dynamic Action Set Multiple Column Values on Same Row

tfa
tfa Member Posts: 408 Bronze Badge
edited Jun 5, 2018 5:23PM in APEX Discussions

I think I've encountered a bug with interactive grid when trying to use a dynamic action to set multiple column values.  Any help would be appreciated.  My current version if 5.1.4.

Goal

To create a dynamic action on one column that when values in that column are changed it will set values on multiple other columns on the same line.

Issue

Defined dynamic action with event type of “change” then associated a “true” action of “set value”. The dynamic action does not set values correctly in all “affected elements” (columns).  Instead it sets the same values in all columns (affected elements) to same value.  The value that is shown is the first value in the sql statement of the “Set Value” dynamic action.

Demo

To show the issue I’ve created a demo app on apex.oracle.com.  To see the issue do the following.

  1. 1- Click “Add Row” button
  2. 2- Select a “Fruit Name” from the LOV.
  3. 3- See how the same values are populated in all columns to right of “fruit name”.

Link to example https://apex.oracle.com/pls/apex/f?p=35582:1

Setup

CREATE SEQUENCE fruits_s NOCACHE INCREMENT BY 1 START WITH 101;

CREATE SEQUENCE order_lines_s NOCACHE INCREMENT BY 1 START WITH 101;

CREATE TABLE fruits

  (fruit_id NUMBER(15)

  ,fruit_name VARCHAR2(50)

  ,shape VARCHAR2(50)

  ,color VARCHAR2(50)

  ,taste VARCHAR2(50)

  ,CONSTRAINT fruits_pk PRIMARY KEY (fruit_id)

  );

CREATE TABLE order_lines

  (order_line_id NUMBER(15)

  ,fruit_id NUMBER(15)

  ,CONSTRAINT order_line_pk PRIMARY KEY (order_line_id)

  ,CONSTRAINT order_line_fk1 FOREIGN KEY (fruit_id) REFERENCES fruits

  );

INSERT INTO fruits VALUES (fruits_s.nextval, 'Orange', 'round', 'orange', 'sweet');

INSERT INTO fruits VALUES (fruits_s.nextval, 'Apple', 'round', 'red', 'tart');

INSERT INTO fruits VALUES (fruits_s.nextval, 'Grape', 'round', 'green', 'sweet');

INSERT INTO fruits VALUES (fruits_s.nextval, 'Plum', 'round', 'purple', 'sweet');

INSERT INTO order_lines VALUES (order_lines_s.nextval, 101);

INSERT INTO order_lines VALUES (order_lines_s.nextval, 102);

COMMIT;

Defined an interactive grid with this query.  The idea is that user selects from LOV a value for “fruit_id” then the dynamic action returns values for the other columns (shape, color, taste).

select ol.ORDER_LINE_ID

,ol.FRUIT_ID

,f.shape

,f.color

,f.taste

from ORDER_LINES ol

,fruits f

where ol.fruit_id = f.fruit_id

Defined dynamic action on fruit_id column.

pastedImage_0.png

Dynamic action definition as event of “Change”

pastedImage_1.png

True action is Set Value

pastedImage_3.png

Image shows the result for the dynamic action to set values does not set multiple values correctly.  See how the same value is used in all columns.

pastedImage_4.png

Thanks,

Todd

Tagged:
tfaSrini.Ramanujam

Answers

This discussion has been closed.