How to prevent Master navigation when detail has outstanding changes?

Currently we check on the current-row-changed event if the detail block isDirty we raise an exception which prevents the detail block from repopulating with the new Masters data, however the Master record still changes to a new record... how can we prevent this?

asked 10 Feb '16, 09:25

apacheuk's gravatar image

accept rate: 0%

OK, so I might have a solution :) I can't think of anyway other way, which is why I'm asking here in the hope someone out there has more elegant solution.

When the user clicks on a new record in the master grid I check to see if my detail grid has outstanding changes, if it does I raise an exception and store the preivious rowid (ie the row with the outstanding changes associated) in a package variable. I then display an alert and then navigate back to the previous row.

I figured this would work but obviously the whole process kicks off again when I set the row back to the previous one... hence the package variable. I use this to check to see if the rowid is the same as the package vaiable rowid, if they match ie we are navigating back to the row that caused the initial error we just don't do anything.

It seems to work, but I'm not sure... what do you all think????

PROCEDURE pop_class AS v_class_type_code class_type.class_Type_code%TYPE; e_outstanding_changes EXCEPTION; BEGIN

if (nvl(dp_fs.pv_rowid,0) != api_datasource.getcurrentrowid('CLASS_TYPE_VW1')) then IF (api_datasource.isdirty('CLASS_VW1') = 'Y') THEN raise e_outstanding_changes; ELSE IF (api_datasource.getcurrentrowid('CLASS_TYPE_VW1') IS NOT NULL) THEN -- get id of the currently selected row v_class_type_code := api_datasource.getColumnValueTX('CLASS_TYPE_VW1.CLASS_TYPE_CODE'); -- populate classes belonging to the selected type_code api_datasource.setBindvar('CLASS_VW1.classtypecode', v_class_type_code); api_datasource.executeQuery('CLASS_VW1'); ELSE api_datasource.clear('CLASS_VW1'); END IF; END IF; end if; EXCEPTION WHEN e_outstanding_changes THEN dp_fs.pv_rowid := api_datasource.getpreviouscurrentrowid('CLASS_TYPE_VW1'); api_alert.setTitle('error','Outstanding Changes'); api_alert.setlabel('error','You have unsaved changes, navigation not permitted');'error'); api_datasource.setcurrentrow('CLASS_TYPE_VW1',api_datasource.getpreviouscurrentrowid('CLASS_TYPE_VW1')); END pop_class;


answered 10 Feb '16, 10:13

apacheuk's gravatar image

accept rate: 0%

Hi Simon,

This looks like the right way to me.

Kind Regards,

(12 Feb '16, 03:15) Yalim ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 10 Feb '16, 09:25

Seen: 559 times

Last updated: 12 Feb '16, 03:15

© Copyright Gerger 2017