Home » Developer & Programmer » Forms » Not able to clear dependent lov (merged 7)
Not able to clear dependent lov (merged 7) [message #674054] Mon, 31 December 2018 02:54 Go to next message
firozali
Messages: 5
Registered: December 2018
Junior Member
I have master detail form. Master Block have lov1 dependent to detail block lov2.
while updating if select lov1 dependent lov2 selected record should be clear.

my code below:
Declare
  v_column XX_CC_SCM_REQ_LINES_V.TASK_NUMBER%type;
  cursor my_cursor is
    select TASK_NUMBER from XX_CC_SCM_REQ_LINES_V where PROJECT_ID = :XX_CC_SCM_REQ_HEADER_V.PROJECT_ID;

begin
  open my_cursor;

  fetch my_cursor into v_column;

  if my_cursor%notfound then
     :XX_CC_SCM_REQ_LINES_V.TASK_NUMBER := null;
  end if;

  close my_cursor;

end;
But its clear only one record. I have multiple line.

Please suggest me.


[EDITED by LF: applied [code] tags]
[EDITED #2 by LF: Michel merged 5 duplicates; I removed all but the original]

[Updated on: Tue, 01 January 2019 14:15] by Moderator

Report message to a moderator

Re: form developer 10g [message #674056 is a reply to message #674054] Mon, 31 December 2018 07:44 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
I don't understand your explanation, but Where is your loop? You cannot clear columns of a multi-record block unless you loop through all the rows.
Re: form developer 10g [message #674057 is a reply to message #674054] Mon, 31 December 2018 07:48 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Maybe I misunderstood what you are saying, but - in a master-detail form, a detail block's LoV acts as master block's "master" LoV? Sounds opposite of how it should be.

Also, what does this mean:
Quote:
if select lov1 dependent lov2 selected record should be clear.
What exactly do you select? Master's or detail's LoV? Which record should be cleared? Master? Detail? The last sentence suggests that it is the detail block, after all.

If so, then you'll have to loop through all rows in the detail block, check whether they satisfy the condition and ... well, "clear" them (whatever that means) - might be just setting some items to NULL, might be DELETE_RECORD built-in usage.

P.S. Right; exactly what Joy Division has said (didn't see his message as I was writing mine).

[Updated on: Mon, 31 December 2018 07:49]

Report message to a moderator

Re: Oracle form 10g [message #674064 is a reply to message #674054] Tue, 01 January 2019 01:07 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.

Repeating the same question again and again won't give you more answers just irritate people and lead them to ignore you.

Not able to clear dependent lov [message #674082 is a reply to message #674054] Thu, 03 January 2019 01:35 Go to previous messageGo to next message
firozali
Messages: 5
Registered: December 2018
Junior Member
hello experts,
I want to clear the detail block LOV selected record when i select value from master block LOV. My Scenario is:
I have text box for supplier in Master block. The data is populated through LOV. If i change the supplier, i need to clear the data in Detailed block(associated lov records only).

When i am changing LOV from master block its clear one one record in detail block.
I am not able to clear all records in detail block item field in POST-CHANGE TRIGGER.

begin
IF :masterblock.col1 != :detail.col1 THEN
:detailblock.col2:= null;
END IF;
end;


Can any one guide me how to solve this problem.

Regards,
firoz
Re: Not able to clear dependent lov [message #674086 is a reply to message #674082] Thu, 03 January 2019 03:28 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Generally speaking you do something like this by looping through all the records in the detail block using:
go_block('<detail block');
first_record;
loop
  <clear item>
  exit when :system.last_record = 'TRUE';
  next_record;
end loop;

However You can't do that from post-change or when-validate-item, as navigation built-ins are all restricted built-ins and so can't be run from those triggers. (read up on restricted built-ins in form builder help if you don't understand that).

There's no way I can think of to do what you want.
Re: Not able to clear dependent lov [message #674088 is a reply to message #674086] Thu, 03 January 2019 04:07 Go to previous messageGo to next message
firozali
Messages: 5
Registered: December 2018
Junior Member
cookiemonster wrote on Thu, 03 January 2019 03:28
Generally speaking you do something like this by looping through all the records in the detail block using:
go_block('<detail block');
first_record;
loop
  <clear item>
  exit when :system.last_record = 'TRUE';
  next_record;
end loop;

However You can't do that from post-change or when-validate-item, as navigation built-ins are all restricted built-ins and so can't be run from those triggers. (read up on restricted built-ins in form builder help if you don't understand that).

There's no way I can think of to do what you want.
sir i did as you mentioned in when_validate_item/post-change trigger but its not working:
my code is:
go_block('<detail block');
first_record;
loop
  go_ITEM('detail block.item_name');
  clear_item;
  exit when :system.last_record = 'TRUE';
  next_record;
end loop;


Re: Not able to clear dependent lov [message #674095 is a reply to message #674088] Thu, 03 January 2019 05:23 Go to previous message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Re-read my previous post. All of it this time.
Then ask yourself why you thought that would work.
Previous Topic: Fortnightly off required
Next Topic: Migrating from 6i to 10g
Goto Forum:
  


Current Time: Thu Mar 28 03:22:27 CDT 2024