Hello,
I am trying to create an automatic value in an interactive grid column when a new record is created.
I have tried putting the SQL below in as the default value:
SELECT MAX(LINE_NUMBER)+1 FROM UMA_LIS_TRANSECT_PROG WHERE LOIS_CODE = P27_LOIS_CODE.
and setting a page item P27_LOIS_CODE with a dynamic action to load its value.
The dynamic action is
$(this.triggeringElement).parent().data('id'). I presume it gets the PK on the parent region/table which in my case is LOIS_CODE.
But no luck.
So I tried creating a dynamic item that sets the value of the column LINE_NUMBER once the first column is selected. I.e. with a GET FOCUS dynamic action as below:
Dynamic Action is called Load_LOIS
True actions are:
SET VALUE with the javascript "$(this.triggeringElement).parent().data('id')". Again I presume this gets the PK of the parent region/table.
EXECUTE PL/SQL CODE
UPDATE LINE_NUMBER SET = SELECT MAX(LINE_NUMBER)+1 FROM IRIS.UMA_LIS_TRANSECT_PROG WHERE LOIS_CODE = :P27_LOIS_CODE;
I have also tried
SELECT MAX(LINE_NUMBER)+1 INTO &LINE_NUMBER. WHERE LOIS_CODE = :P27_LOIS_CODE;
Neither have correct syntax.
Has anybody any suggestions on how I can set the value of LINE_NUMBER to MAX + 1 when creating a new record within an interactive grid?
Thank You,
Derek.