Home » Developer & Programmer » Forms » Record Groups and Alerts (Oracle Form Builder 10g)
|
|
|
Re: Record Groups and Alerts [message #600647 is a reply to message #600642] |
Sun, 10 November 2013 12:52 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/179476.png) |
jgjeetu
Messages: 373 Registered: July 2013 Location: www.Orafaq.com/Forum
|
Senior Member |
![jgjeetu@gmail.com](/forum/theme/orafaq/images/google.png)
|
|
thats ok n thanks mughal bro but i think by mistake you provided wrong .fmb file beacuase there are many errors in this fmb file which i corrected.
1. if you will run this .fmb file then you will get error on popup window i.e frm-41334 invalid record group for popultaion.
reason:-
add_list_element('list5',king,i.deptno,i.deptno);
correction:-
add_list_element('deptno',king,i.deptno,i.deptno);
(bcoz item name is deptno which is list_item combo_box)
=> now you will get same error but not on popup, only in taskbar.
reason:- You forgot to delete when_new_form_instance trigger on form level
=> now you will get no error now click on deptno list_item, there are duplicate values
reason :- because earlier i manually entered values in deptno list_item and you forgot to
clear that list thats why it is showing duplicate values:-
solution:-
declare
cursor tdeptno is select deptno from dept;
king number(5):=0;
begin
clear_list('emps.deptno');
for i in tdeptno
loop
king:=king+1;
add_list_element('deptno',king,i.deptno,i.deptno);
end loop;
end;
Now form is working perfectly, now no error.
Now my question begins
In last code you have created a cursor tdeptno which is fetching all deptno values from dept table.
after that you created varibale king which is number type and size is 5 ,
after that you used for loop which is fetching values from tdeptno cursor ,
but i am not able to understand this syntax:-
king:=king+1;
add_list_element('deptno',king,i.deptno,i.deptno);( explain this code also)
kindly explain this code n whats the use of creating king variable and how the size of king variable
i.e 5 is affecting the query. because i created 6 record in dept table and it is showing all 6 deptno
so i am getting confused so please explain.
Meanwhile i took form online_help and got this but sill facing problem
PROCEDURE ADD_LIST_ELEMENT(list_name VARCHAR2, list_index, NUMBER,list_label VARCHAR2, list_value VARCHAR2);
PROCEDURE ADD_LIST_ELEMENT(list_id ITEM, list_index VARCHAR2, list_label VARCHAR2, list_value VARCHAR2);
list_id:- Specifies the unique ID that Oracle Forms assigns when it creates the list item. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
list_name:- The name you gave to the list item when you created it. The data type of the name is VARCHAR2.
list_index:- Specifies the list index value. The list index is 1 based.
list_label:- Specifies the VARCHAR2 string that you want displayed as the label of the list element.
list_value:- The actual list element value you intend to add to the list item.
and question related to alerts still stands, Explain that also.
Thanks
[Updated on: Sun, 10 November 2013 13:08] Report message to a moderator
|
|
|
Re: Record Groups and Alerts [message #600650 is a reply to message #600647] |
Sun, 10 November 2013 15:01 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/1229663c86eb1a441385fe710cd9116e?s=64&d=mm&r=g) |
mughals_king
Messages: 392 Registered: January 2012 Location: pakistan
|
Senior Member |
|
|
jgjeetu wrote on Sun, 10 November 2013 12:52thats ok n thanks mughal bro but i think by mistake you provided wrong .fmb file beacuase there are many errors in this fmb file which i corrected.
1. if you will run this .fmb file then you will get error on popup window i.e frm-41334 invalid record group for popultaion.
reason:-
add_list_element('list5',king,i.deptno,i.deptno);
Quote:
add_list_element('deptno',king,i.deptno,i.deptno);
(bcoz item name is deptno which is list_item combo_box)
Quote:
reason :- because earlier i manually entered values in deptno list_item and you forgot to
clear that list thats why it is showing duplicate values:-
Quote:
Now my question begins
after that you created varibale king which is number type and size is 5 ,
after that you used for loop which is fetching values from tdeptno cursor ,
but i am not able to understand this syntax:-
Quote:
king:=king+1;
add_list_element('deptno',king,i.deptno,i.deptno);( explain this code also)
kindly explain this code n whats the use of creating king variable and how the size of king variable
i.e 5 is affecting the query. because i created 6 record in dept table and it is showing all 6 deptno
so i am getting confused so please explain.
Quote:
and question related to alerts still stands, Explain that also.
Dear first of fall i always uploading fmb when i checked properly with me it is 100% 2ndly have you checked my list fmb i did not define any trigger regarding when-new-form-instance i just simply pick data from table "deptno" and added into list item by using cursor "Add_list_element yes may be i forgot to change in your fmb which is "emps_pic_corrected.fmb" and sorry about that as far as concern CURSOR let me explain first little things about CURSORS what is cursor?
There are different types of cursors but Let me explain about these 3 cursors
(A)Implicit cursor (B)Explicit cursor
(Handle by oracle) (user defined)
Steps:
Declare
Open
Fetch
Close
every query that we issue on a database is an implicit cursor for EXAMPLE select,update, Delete etc.
IMPLICIT CURSOR oracle uses a cursor for every select..into statement that is not referenced by an explicit cursor. it also uses cursors for all insert, update, or delete statement that it processes these are called implicit cursors.
EXPLICIT CURSOR is a user defined cursor. Cursor are PL/SQL objects builtin upon SELECT statements that allow you to better manipulate queries records returned by quries.
CURSOR <cursor_name> IS <select_statement>;
CURSOR VARIABLE :- in the examples used so far the select statement that populates a
cursor with data is specified when the cursor is declared meaning that if two or more program units need to manipulate data from the same cursor each of them will have to declare, open,fetch and close the cursor. cursor can be declared and manipulated like any other PL/SQL variable the cursor variables.
NOW little bit about "Add_list_element"?
You can add list elements by adding elements one at a time or by populating a list item with values contained in a record group.
You can add values to a list item by using these built-in subprograms:
ADD_LIST_ELEMENT built-in :- adds a single element to a list item.
POPULATE_LIST built-in :-
Removes the contents of the current list and populates the list with the values from a record group.the record group must be created at runtime and it must have the following two column (VARCHAR2) structure: Column 1:the list label :column 2: the list value.
Now let me explain what is "KING" variable which i defined and why?.
king:=king+1;--what this king variable doing---simple adding(Creating) rows,1,2,3,4....;in list5 item
FRM-41334: "Invalid record group for list population" You tried to populate a list from a record group that does not exist.
Now dear friend upload your fmb with table structure i shall check thoroughly hope its not that much problem you are just confusing.
Dear if you are having a problem with creating recordgroup then take this example how to do this.
create table test(tst_id number,tst_name varchar2(25));
insert into test values(1,'mirror');
insert into test values(2,'Table');
insert into test values(3,'Speaker');
commit;
---WHEN-NEW-FORM-INSTANCE---
DECLARE
GROUP_ID RECORDGROUP;
LIST_ID ITEM := FIND_ITEM('mughal');
STATUS NUMBER;
BEGIN
GROUP_ID := FIND_GROUP('TYP');
IF NOT ID_NULL(GROUP_ID) THEN
DELETE_GROUP(GROUP_ID);
ELSE
GROUP_ID := CREATE_GROUP_FROM_QUERY
('TYP','SELECT tst_name,TO_CHAR(tst_id) FROM test');
END IF;
STATUS := POPULATE_GROUP('TYP');
POPULATE_LIST(LIST_ID,GROUP_ID);
END;
Hope you got something about cursors, add_list_elements and record_group
Regard
Mughal
[Updated on: Sun, 10 November 2013 16:43] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Aug 25 02:15:57 CDT 2024
|