Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 251
  • Last Modified:

dynamic lov in oracle form 11gR2

DYNAMIC LOV


HI i like to create dynamic lov

i have two lov have to store information based on what the use has selected

parent Lov


child Lov


if the user select parent lov i what to save

the selected object name in column obj_name of cal_obj table and the id of selected objname in obj_parent column


 
if the user select parent lov i what to save
he selected object name in column obj_name of cal_obj table and the id of selected objname in obj_child column

this is the table structure
create table CAL_OBJ
(
  obj_child   NUMBER(4),
  obj_name    VARCHAR2(100),
  obj_type    VARCHAR2(50),
  obj_title   VARCHAR2(50),
  description VARCHAR2(50),
  obj_parent  NUMBER(5)
);


 insert into cal_obj(obj_child,                       
                        obj_name,
                        obj_type)
                    values(1192,                          
                           'MainObject',
                           'Form');
                           
                           
                           
                           insert into cal_obj(obj_parent,
                                               obj_child,                       
                        obj_name,
                        obj_type)
                    values(1192, 
                            1193,                         
                           'SecondObject',
                           'Form');
                           
                               insert into cal_obj(obj_parent,
                                               obj_child,                       
                        obj_name,
                        obj_type)
                    values(1193, 
                            1194,                         
                           'ThirdObject',
                           'Form');

Open in new window

Untitledparent.png
Untitled.png
dis.png
toad.png
0
chalie001
Asked:
chalie001
  • 8
  • 6
1 Solution
 
flow01Commented:
Don't  create dynamic  lov:   create 2 distinct lov's based on 2 recordgroups and assign those lov's to the different items in  your form.
Else try   to explain  the behaviour you want to see  (if the users does  xxx then  the form should yyy)
0
 
chalie001Author Commented:
ok the behaviour is

if User select parentLov
 - copyid = obj_child
-  parentid = obj_parent
*disable child lov

if user select childlov
  -copyid=objparent
 -childlovid = obj_child
*disable parent lov
0
 
flow01Commented:
How does the user select parentLov  and to what item  should the lov  be attached.
How does the user select childLov  and to what item  should the lov  be attached.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
chalie001Author Commented:
hi this is how i store lov value

i select object from the first screen than i navigate to next screen with the object id
-in the second screen i display the selected objectname and id of selected object

if user what to make parent of the display object the user select the parent lov
than  - copyidfrom selected object from previous screen = obj_child
-  parentid = obj_parent

this is when-button-pressed tigger button lov do when pressed parent lov
BEGIN
  go_item('cal_erd.DISPLAYNAME');
  do_key('List_values');
  copy ('0', 'GLOBAL.save_mouse_record');
END;

i also attach how the table is in database
firstscreen.png
child.png
Untitledparentlov.png
Untitledtable.png
attachlov.png
childlov.png
0
 
flow01Commented:
Close: I will make some assumptions
.If  the user hits  button1 and the parent lov is shown.  It works by navigating to cal_erd.DISPLAYNAME and showing its lov.
and you want that if user hits button2 the child lov is shown ?
Then
1 You could use another item DISPLAYNAME2 at the same position as DISPLAYNAME and attach the childlov to that new
item. Navigate in the when button-pressed to DISPLAYNAME2 .
or
2 navigate to the same item but change the attached lov before navigation

this is when-button-pressed tigger button lov do when pressed parent lov
BEGIN
  set_item_property('cal_erd.DISPLAYNAME',LOV_NAME,'PARENT_LOV');
  go_item('cal_erd.DISPLAYNAME');
  do_key('List_values');
  copy ('0', 'GLOBAL.save_mouse_record');
END;

this is when-button-pressed tigger button lov do when pressed CHILD lov
BEGIN
  set_item_property('cal_erd.DISPLAYNAME',LOV_NAME,'CHILD_LOV');
  go_item('cal_erd.DISPLAYNAME');
  do_key('List_values');
  ??;
END;
0
 
chalie001Author Commented:
.If  the user hits  button1 and the parent lov is shown.  It works by navigating to cal_erd.DISPLAYNAME and showing its lov.
and you want that if user hits button2 the child lov is shown ?=No


If  the user hits  button1 and the parent lov is shown
--copyid=objchild
parentlovid is already set to obj_parent
and disable the child lov textitem



If  the user hits  button1 and the childl lov is shown.
--copyid=objparentid
childlovid is already set to objchild
and disable the parent lov text itemlov showing how to attach parent/child lov.If  the user hits  button1 and the parent lov is shown.  It works by navigating to cal_erd.DISPLAYNAME and showing its lov.
and you want that if user hits button2 the child lov is shown ?=No


If  the user hits  button1 and the parent lov is shown
--copyid=objchild
parentlovid is already set to obj_parent
and disable the child lov textitem



If  the user hits  button1 and the childl lov is shown.
--copyid=objparentid
childlovid is already set to objchild
and disable the parent lov text item

showing lov how it must attch id
0
 
chalie001Author Commented:
am geting this error
FRM-40735: WHEN-BUTTON-PRESSED trigger raised unhandled exception ORA-06502  
 
hi am trying to set-item -property when lov button pressed but am geting this error

 
my lov button trigger is

FRM-40735: WHEN-BUTTON-PRESSED trigger raised unhandled exception ORA-06502

i try to do this
BEGIN
--set_item_property('CAL_ERD.OBJ_CHILD',:CAL_ERD.COPYOBJID);

  go_item('cal_erd.DISPLAYNAME');
    SET_ITEM_INSTANCE_PROPERTY('CAL_ERD.OBJ_CHILD',:CAL_ERD.COPYOBJID,'CAL_ERD.OBJ_CHILD');
  do_key('List_values');
  copy ('0', 'GLOBAL.save_mouse_record');
END;

11.CAL_ERD.OBJ_CHILD=:CAL_ERD.COPYOBJID  BEGIN
  go_item('cal_erd.DISPLAYNAME');
  --set_item_property('CAL_ERD.OBJ_CHILD',:CAL_ERD.COPYOBJID);
  SET_ITEM_INSTANCE_PROPERTY('CAL_ERD.OBJ_CHILD',:CAL_ERD.COPYOBJID,'CAL_ERD.OBJ_CHILD');
  do_key('List_values');
  copy ('0', 'GLOBAL.save_mouse_record');
END;

when i user  --set_item_property('CAL_ERD.OBJ_CHILD',:CAL_ERD.COPYOBJID); it does not set my iten to the value i what

CAL_ERD.OBJ_CHILD=:CAL_ERD.COPYOBJID
am in oracle 11gR2
0
 
flow01Commented:
You can't change the attached lov an item-instance item:
don't use SET_ITEM_INSTANCE_PROPERTY  but SET_ITEM_PROBERTY
if there are troubles setting it back to its default value we solve that afterwards.

Use the SET_ITEM_PROPERTY before the 'GO_ITEM'  because changing the properties of a current_item does not work (always?).

You want to change the LOV of the item that is the current-item if you execute the do_key('List_values') :
so the go_item  and the set_item_property should refer to the same item.

You want to change the LOV_NAME : the identification of that property  is an number and LOV_NAME  is an oracle-forms constant with a value of that number. So use LOV_NAME (without quotes) as the second argument of the set_item_property.
If you want to check : add MESSAGE( 'The value of LOV_NAME =' || LOV_NAME, acknowledge);

The 3e argument is the name of the LOV  you want to assign:  it should be a literal  containing a valid LOV_NAME :
'PARENT_LOV'  and 'CHILD_LOV' are,  'CAL_ERD.OBJ_CHILD' not.

I assume you did change my code because i did not do what you wanted :  what problem did occur?
0
 
chalie001Author Commented:
hi i whated this
BEGIN
      copy(:cal_erd.copyobjid,'cal_erd.obj_child');
  go_item('cal_erd.DISPLAYNAME');
  do_key('List_values');
  copy ('0', 'GLOBAL.save_mouse_record');
END;
0
 
flow01Commented:
Yes, but that does  not do what you want ?  Or does it?
0
 
chalie001Author Commented:
as far i can see it does it copy the id to another text field when i click the lov button
0
 
flow01Commented:
You  are not easy to help.
Your answer suggests that your trigger does what you want, but you did not ask this question if it where. Or are you ready now?
I think you want to display an lov in both triggers , but that you wanted to fill different items  with the choise of the user depending on choosing the child or parent button. Is that correct ?
I gave a solution to do it,  you changed the code so it gives errors and then you say you want to keep  the code you originally had.  What help do you expect?
0
 
chalie001Author Commented:
sorry for not to be clear with my question
0
 
chalie001Author Commented:
correct
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now