1
votes

From my APEX page I am opening a pop up page and trying to load it with data from the database. To do so, I used Pre-Rendering After Header Process. Process type is set to PL/SQL code:

BEGIN
  IF :P3_RECORD_ID IS NOT NULL THEN
     select TYPE_ID, RECORD_TEXT
     INTO :P3_TYPE_ID, :P3_RECORD_TEXT
     from TABLE1
     where RECORD_ID = :P3_RECORD_ID;
  END IF;
END;

On the pop up page I have a dropdown (P3_TYPE_ID) which is filled from the LOV and a text field (P3_RECORD_TEXT). The values show up in the session state but not in the dropdown or a text field. I can't figure out what am I doing wrong...

I also tried Automated Row Fetch but that did not load any values into fields either, just into session state

1
That behavior is expected if on the section SOURCE the "type" field is "null" and "used" is "Always, replacing any existing value in session state". But, if this process is fast, the solution of Littlefoot is better.romeuBraga

1 Answers

1
votes

Did you consider using default value for those items? It would be a "PL/SQL Function Body" and look like this (for P3_TYPE_ID):

declare
  l_type_id table1.type_id%type;
begin
  select max(type_id)
  into l_type_id
  from table1
  where record_id = :P3_RECORD_ID;

  return l_type_id;
end;

I used MAX function to avoid possible NO_DATA_FOUND and TOO_MANY_ROWS errors. Handle them in EXCEPTION section, if necessary.

Similarly, populate P3_RECORD_TEXT.