Home » Developer & Programmer » Forms » lov values shown again after clear_form
lov values shown again after clear_form [message #655157] Tue, 23 August 2016 03:54 Go to next message
saraa
Messages: 14
Registered: February 2015
Junior Member
hi
I created a tabular form with a trigger when validate item what trigger is doing that once a selected lov value skipped in the second record and so on.
It is working prefectly fine. The thing i want is when i commit and clear the form all the lov values should be shown again. it is happining when i again run a form but i want it on clear_form because i cant run form again and again.
How is this possible please help?
Re: lov values shown again after clear_form [message #655164 is a reply to message #655157] Tue, 23 August 2016 04:23 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It seems that you are creating a LoV dynamically (using CREATE_GROUP_FROM_QUERY / POPULATE_GROUP). If that's so, you'll have to reinstate query as it now, obviously, doesn't contain all values as it does when the form starts and the record group is in its initial state. Basically, you'd have to run the "initial" CREATE_GROUP_BY_QUERY once again.


[Fixed typo; was CREATE_GROUP_BY_QUERY]

[Updated on: Wed, 24 August 2016 05:05]

Report message to a moderator

Re: lov values shown again after clear_form [message #655165 is a reply to message #655164] Tue, 23 August 2016 04:35 Go to previous messageGo to next message
saraa
Messages: 14
Registered: February 2015
Junior Member
I created by wizard. is there any way to refresh lov after commit_form so that all its data came back?
Re: lov values shown again after clear_form [message #655166 is a reply to message #655165] Tue, 23 August 2016 04:37 Go to previous messageGo to next message
saraa
Messages: 14
Registered: February 2015
Junior Member
here is when_validate_item code:
DECLARE
rg_id RecordGroup;
rec_count NUMBER;
BEGIN

-- Get the record group ID --
rg_id := Find_Group( 'lov16' );

-- Get the number of rows --
rec_Count := Get_Group_Row_Count( rg_id );

-- delete the selected row --
FOR j IN 1..rec_Count LOOP
If Get_Group_Number_Cell( 'lov16.EMPNO', j ) = :dept.EMPNO Then
Delete_Group_Row( rg_id, j );
exit ;
End if ;
END LOOP;

END;
Re: lov values shown again after clear_form [message #655167 is a reply to message #655166] Tue, 23 August 2016 05:26 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you are only removing rows from a LoV, I don't see another way to restore them but creating the LoV once again. It means that you'll have to use CREATE_GROUP_FROM_QUERY (instead of having it statically created by the Wizard) - just reuse that code (i.e. SELECT statement). Put it into a procedure so that you could easily call it when the form starts (WHEN-NEW-FORM-INSTANCE trigger) as well as after clearing the form.


[Fixed typo; was CREATE_GROUP_BY_QUERY]

[Updated on: Wed, 24 August 2016 05:06]

Report message to a moderator

Re: lov values shown again after clear_form [message #655169 is a reply to message #655167] Tue, 23 August 2016 05:49 Go to previous messageGo to next message
saraa
Messages: 14
Registered: February 2015
Junior Member
please explain me step by step.
what do you mean by create_group_by_query
Re: lov values shown again after clear_form [message #655176 is a reply to message #655169] Tue, 23 August 2016 16:00 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It is described in Forms Help. Read about it.
Re: lov values shown again after clear_form [message #655179 is a reply to message #655176] Wed, 24 August 2016 02:43 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I apologize, it is CREATE_GROUP_FROM_QUERY (not BY).
Re: lov values shown again after clear_form [message #655195 is a reply to message #655179] Wed, 24 August 2016 09:53 Go to previous messageGo to next message
saraa
Messages: 14
Registered: February 2015
Junior Member
I did this code in when_new_form_instance trigger

DECLARE
rec recordgroup;
status NUMBER;
BEGIN

rec := FIND_GROUP ('REC');

IF NOT ID_NULL (rec) THEN
DELETE_GROUP ('REC');
END IF;
rec := CREATE_GROUP_FROM_QUERY ('REC','select to_char(empno),ename from emp');

status :=populate_group(rec);
populate_list('empno',rec);
END;

now how to do rest of the part that was removing of already selected group rows.
i tried to do that part whith this code but not succeded.
Re: lov values shown again after clear_form [message #655207 is a reply to message #655195] Wed, 24 August 2016 14:10 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I told you, put that code into a procedure. Having it in WNFI trigger isn't the best option as it could have some additional code which you, perhaps, don't want to run once again. However, you can call a procedure as many times as you want, and it'll execute only its code (OK, depending on actual code, it might cause other program units to run, but that's not the point here).
Re: lov values shown again after clear_form [message #655208 is a reply to message #655207] Wed, 24 August 2016 14:16 Go to previous messageGo to next message
saraa
Messages: 14
Registered: February 2015
Junior Member
ok I will put it into procedure; but my qustion was how to do that removing rows work. I just tried to merge removing rows code to create group from query code bit it dosent work for me:
DECLARE
rg_id RecordGroup;
rec_count NUMBER;
status number;
BEGIN

-- Get the record group ID --
rg_id := Find_Group( 'rec' );
IF NOT ID_NULL (rg_id) THEN
DELETE_GROUP ('Rg_id');
END IF;
rg_id := CREATE_GROUP_FROM_QUERY ('Rg_id','select to_char(empno),ename from emp');


status :=populate_group(rg_id);
populate_list('empno',rg_id);

-- Get the number of rows --
rec_Count := Get_Group_Row_Count( rg_id );

-- delete the selected row --
FOR j IN 1..rec_Count LOOP
If Get_Group_Number_Cell( 'rg_id.EMPNO', j ) = :dept.EMPNO Then
Delete_Group_Row( rg_id, j );
exit ;
End if ;

END LOOP;

end;
Re: lov values shown again after clear_form [message #655209 is a reply to message #655208] Wed, 24 August 2016 14:56 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
abira, the first message

once a selected lov value skipped in the second record and so on. It is working prefectly fine

abira, the last message

but my qustion was how to do that removing rows work.



Maybe I don't understand what you want to do; I thought that removing part of the job works perfectly fine, but you need assistance in restoring them back ...
Previous Topic: Oracle Forms 12c : Print Report Directly
Next Topic: connecting database 12c with developer suite 10g
Goto Forum:
  


Current Time: Thu Mar 28 14:48:04 CDT 2024