Search code examples
oracle-apexoracle-apex-5

Oracle Apex 5 Calendar - maintain calendar item form raises no data found


I'm creating a calendar in APEX 5 with associated forms to maintain the calendar items. I'm doing this through the wizard on a table with a primary key (and associated sequence), date column and a caption column. The calendar screen works fine, when I click on an empty date a modal form appears to allow me to add a calendar item. When I click apply changes to the item I get the error ORA-01403: no data found.

I assumed that this is because the pk is not being populated so I added a process on submit after validations to populate the pk column as we have in other default CRUD forms. It has a low sequence number so should execute first when the apply changes button is pressed. The code is:

begin 
if :P5_SIGHTING_ID is null then
    select "#OWNER#"."SIGHTING_SEQ".nextval
      into :P5_SIGHTING_ID
      from sys.dual;
end if; end;

However when I run the form I still get the same no data found error when trying to create the record.

Update - if I change the pk item from hidden to text field I can see that it is populated correctly so the trigger above doesn't seem to be required. I think this error is raised during redirect back to the main calendar but I'm not sure how to debug this.


Solution

  • OK, I've worked this out - will add in case it can help others.

    The error occurs in the Process Row, Automatic Row Processing (DML) process. By default the form generated by the wizard is not showing the create button as it has a condition on it - however this doesn't appear to work by default. If I change the condition on the create button to ALWAYS the form works as I'd expect and I can both create and update items in my calendar.