records not displaying in a specific text item [message #543349] |
Tue, 14 February 2012 06:36 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/9d3a737834daa8c057331fef1633aed5?s=64&d=mm&r=g) |
baliberde
Messages: 201 Registered: January 2012 Location: outer space
|
Senior Member |
|
|
Hello, I have for example two text items(number of records to display is set to 9). What I want is when i go to studentprofile block, it should automatically shows his subjects that are already taken up. the first text item is for 1st semester subjects and the other for 2nd semester.
here is the structure of my subjsec table:
ID number(1)
subj_code varchar2(10)
day varchar2(10)
and for subjects table:
subj_code varchar2(10)
description varchar2(50)
units number(1)
semester varchar2(10)
I restricted subjects that are in 1st sem. So i did something like this in my code:
DECLARE
CURSOR studgrade_cur IS
SELECT g.stud_id, g.grade, g.subj_code, s.description, s.units, s.semester
FROM studgrades g , subjects s
WHERE g.subj_code = s.subj_code
AND g.stud_id = :Studentprofile.student_id;
BEGIN
GO_BLOCK('STUDENTPROFILE');
FOR studgrade_rec IN studgrade_cur
LOOP
:STUDENTPROFILE.student_id := :PARAMETER.param_student_id;
:studentprofile.txtlname := :PARAMETER.param_lname;
:studentprofile.txtfname := :PARAMETER.param_fname;
:studentprofile.txtmname := :PARAMETER.param_mname;
:studentprofile.rg_gender := :PARAMETER.param_gender;
:studentprofile.course := :PARAMETER.param_course;
:studentprofile.lstyearstatus := :PARAMETER.param_yearstatus;
IF studgrade_rec.semester = '1st' THEN
:STUDENTPROFILE.subjectname := studgrade_rec.subj_code;
:STUDENTPROFILE.description := studgrade_rec.description;
:STUDENTPROFILE.units := studgrade_rec.units;
:STUDENTPROFILE.grade := studgrade_rec.grade;
NEXT_RECORD;
END IF;
IF studgrade_rec.semester = '2nd' THEN
:STUDENTPROFILE.subj_2ndsem := studgrade_rec.subj_code;
:STUDENTPROFILE.desc_2ndsem := studgrade_rec.description;
:STUDENTPROFILE.units_2ndsem := studgrade_rec.units;
:STUDENTPROFILE.grade_2ndsem := studgrade_rec.grade;
NEXT_RECORD;
END IF;
END LOOP;
END;
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: records not displaying in a specific text item [message #543671 is a reply to message #543665] |
Thu, 16 February 2012 05:21 ![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) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Either there aren't as many matching records as you think there are, or the first record has gone off the top of the screen.
There is a record counter at the bottom of the screen. How many records does it say you have?
You should also consider having an order by on the cursor.
|
|
|
|
Re: records not displaying in a specific text item [message #543676 is a reply to message #543672] |
Thu, 16 February 2012 06:12 ![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) |
![](//www.gravatar.com/avatar/9d3a737834daa8c057331fef1633aed5?s=64&d=mm&r=g) |
baliberde
Messages: 201 Registered: January 2012 Location: outer space
|
Senior Member |
|
|
it says there are 11 records. I have added ORDER BY clause. and this is my new screenshot.
![http://i40.tinypic.com/5vvyg7.jpg](http://i40.tinypic.com/5vvyg7.jpg)
my new code
DECLARE
CURSOR studgrade_cur IS
SELECT g.stud_id, g.grade, g.subj_code, s.description, s.units, s.semester
FROM studgrades g , subjects s
WHERE g.subj_code = s.subj_code
AND g.stud_id = :Studentprofile.student_id
ORDER BY g.subj_code ASC;
BEGIN
Set_Menu_Item_Property('TRANSACTION_MENU.ADD', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.EDIT', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.DELETE', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.SAVE', ENABLED,PROPERTY_FALSE);
GO_BLOCK('STUDENTPROFILE');
--GO_BLOCK('GRADES2NDSEM');
FOR studgrade_rec IN studgrade_cur
LOOP
:STUDENTPROFILE.student_id := :PARAMETER.param_student_id;
:studentprofile.txtlname := :PARAMETER.param_lname;
:studentprofile.txtfname := :PARAMETER.param_fname;
:studentprofile.txtmname := :PARAMETER.param_mname;
:studentprofile.rg_gender := :PARAMETER.param_gender;
:studentprofile.course := :PARAMETER.param_course;
:studentprofile.lstyearstatus := :PARAMETER.param_yearstatus;
IF studgrade_rec.semester = '1st' THEN
:STUDENTPROFILE.subjectname := studgrade_rec.subj_code;
:STUDENTPROFILE.description := studgrade_rec.description;
:STUDENTPROFILE.units := studgrade_rec.units;
:STUDENTPROFILE.grade := studgrade_rec.grade;
NEXT_RECORD;
END IF;
IF studgrade_rec.semester = '2nd' THEN
:GRADES2NDSEM.subj_2ndsem := studgrade_rec.subj_code;
:GRADES2NDSEM.desc_2ndsem := studgrade_rec.description;
:GRADES2NDSEM.units_2ndsem := studgrade_rec.units;
:GRADES2NDSEM.grade_2ndsem := studgrade_rec.grade;
NEXT_RECORD;
END IF;
END LOOP;
:SYSTEM.MESSAGE_LEVEL := '5';
Up;
--IF NOT FORM_SUCCESS THEN
-- Message('');
--END IF;
--:SYSTEM.SUPPRESS_WORKING := 'TRUE';
END;
|
|
|
Re: records not displaying in a specific text item [message #543679 is a reply to message #543676] |
Thu, 16 February 2012 06:49 ![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) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Well not all the records fit on screen do they? I suggest you add some scroll bars.
I also suggest you completly split the code that populates the two blocks. So use two seperate cursors and a seperate loop for each.
At the moment the next_record is being done in the STUDENTPROFILE regardless of which block you just altered as that's where the cursor is.
|
|
|
Re: records not displaying in a specific text item [message #543685 is a reply to message #543679] |
Thu, 16 February 2012 08:11 ![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) |
![](//www.gravatar.com/avatar/9d3a737834daa8c057331fef1633aed5?s=64&d=mm&r=g) |
baliberde
Messages: 201 Registered: January 2012 Location: outer space
|
Senior Member |
|
|
hi, i did split the code but now, the records for 2nd semester didn't appear.
check my code:
DECLARE
CURSOR studgrade_cur IS
SELECT g.stud_id, g.grade, g.subj_code, s.description, s.units, s.semester
FROM studgrades g , subjects s
WHERE g.subj_code = s.subj_code
AND g.stud_id = :Studentprofile.student_id
ORDER BY g.subj_code ASC;
CURSOR studgrade2nd_cur IS
SELECT g.stud_id, g.grade, g.subj_code, s.description, s.units, s.semester
FROM studgrades g , subjects s
WHERE g.subj_code = s.subj_code
AND g.stud_id = :Studentprofile.student_id
ORDER BY g.subj_code ASC;
BEGIN
Set_Menu_Item_Property('TRANSACTION_MENU.ADD', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.EDIT', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.DELETE', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.SAVE', ENABLED,PROPERTY_FALSE);
GO_BLOCK('STUDENTPROFILE');
FOR studgrade_rec IN studgrade_cur
LOOP
:STUDENTPROFILE.student_id := :PARAMETER.param_student_id;
:studentprofile.txtlname := :PARAMETER.param_lname;
:studentprofile.txtfname := :PARAMETER.param_fname;
:studentprofile.txtmname := :PARAMETER.param_mname;
:studentprofile.rg_gender := :PARAMETER.param_gender;
:studentprofile.course := :PARAMETER.param_course;
:studentprofile.lstyearstatus := :PARAMETER.param_yearstatus;
IF studgrade_rec.semester = '1st' THEN
:STUDENTPROFILE.subjectname := studgrade_rec.subj_code;
:STUDENTPROFILE.description := studgrade_rec.description;
:STUDENTPROFILE.units1st := studgrade_rec.units;
:STUDENTPROFILE.grade := studgrade_rec.grade;
NEXT_RECORD;
END IF;
END LOOP;
FOR studgrade2nd_rec IN studgrade2nd_cur
LOOP
IF studgrade2nd_rec.semester = '2nd' THEN
:GRADES2NDSEM.subj_2ndsem := studgrade2nd_rec.subj_code;
:GRADES2NDSEM.desc_2ndsem := studgrade2nd_rec.description;
:GRADES2NDSEM.units_2ndsem := studgrade2nd_rec.units;
:GRADES2NDSEM.grade_2ndsem := studgrade2nd_rec.grade;
NEXT_RECORD;
END IF;
END LOOP;
:SYSTEM.MESSAGE_LEVEL := '5';
Up;
--IF NOT FORM_SUCCESS THEN
-- Message('');
--END IF;
--:SYSTEM.SUPPRESS_WORKING := 'TRUE';
END;
|
|
|
Re: records not displaying in a specific text item [message #543688 is a reply to message #543685] |
Thu, 16 February 2012 08:15 ![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) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
As stated above, next_record applies to the block the cursor is in.
The cursor is in STUDENTPROFILE becuase you have a go_block that puts it there.
You need to move the cursor to the correct block with another go_block before you start ttrying to populate the other block.
|
|
|
|
|
|
|
|
|
|
|
|
Re: records not displaying in a specific text item [message #543777 is a reply to message #543719] |
Thu, 16 February 2012 15:30 ![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) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You need to learn to debug such code.
Put messages inside each for loop to display the subject code currently selected.
Also display system.cursor_record and system.current_block.
Work out exactly what it is doing at each point.
And add some scroll bars.
|
|
|
|
Re: records not displaying in a specific text item [message #544010 is a reply to message #543779] |
Sun, 19 February 2012 04:00 ![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) |
![](//www.gravatar.com/avatar/9d3a737834daa8c057331fef1633aed5?s=64&d=mm&r=g) |
baliberde
Messages: 201 Registered: January 2012 Location: outer space
|
Senior Member |
|
|
there's no error message appearing.
pls. check my code if it is correct.
DECLARE
CURSOR studgrade_cur IS
SELECT g.stud_id, g.grade, g.subj_code, s.description, s.units, s.semester
FROM studgrades g , subjects s
WHERE g.subj_code = s.subj_code
AND g.stud_id = :Studentprofile.student_id
ORDER BY g.subj_code ASC;
CURSOR studgrade2nd_cur IS
SELECT g.stud_id, g.grade, g.subj_code, s.description, s.units, s.semester
FROM studgrades g , subjects s
WHERE g.subj_code = s.subj_code
AND g.stud_id = :Studentprofile.student_id
ORDER BY g.subj_code ASC;
BEGIN
Set_Menu_Item_Property('TRANSACTION_MENU.ADD', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.EDIT', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.DELETE', ENABLED,PROPERTY_FALSE);
Set_Menu_Item_Property('TRANSACTION_MENU.SAVE', ENABLED,PROPERTY_FALSE);
GO_BLOCK('STUDENTPROFILE');
FOR studgrade_rec IN studgrade_cur
LOOP
:STUDENTPROFILE.student_id := :PARAMETER.param_student_id;
:studentprofile.txtlname := :PARAMETER.param_lname;
:studentprofile.txtfname := :PARAMETER.param_fname;
:studentprofile.txtmname := :PARAMETER.param_mname;
:studentprofile.rg_gender := :PARAMETER.param_gender;
:studentprofile.course := :PARAMETER.param_course;
:studentprofile.lstyearstatus := :PARAMETER.param_yearstatus;
IF studgrade_rec.semester = '1st' THEN
:STUDENTPROFILE.subjectname := studgrade_rec.subj_code;
:STUDENTPROFILE.description := studgrade_rec.description;
:STUDENTPROFILE.units1st := studgrade_rec.units;
:STUDENTPROFILE.grade := studgrade_rec.grade;
NEXT_RECORD;
END IF;
:SYSTEM.MESSAGE_LEVEL := '5';
Up;
END LOOP;
GO_BLOCK('GRADES2NDSEM');
FOR studgrade2nd_rec IN studgrade2nd_cur
LOOP
IF :System.Cursor_Record = '2' THEN
:STUDENTPROFILE.student_id := :PARAMETER.param_student_id;
:studentprofile.txtlname := :PARAMETER.param_lname;
:studentprofile.txtfname := :PARAMETER.param_fname;
:studentprofile.txtmname := :PARAMETER.param_mname;
:studentprofile.rg_gender := :PARAMETER.param_gender;
:studentprofile.course := :PARAMETER.param_course;
:studentprofile.lstyearstatus := :PARAMETER.param_yearstatus;
IF studgrade2nd_rec.semester = '2nd' THEN
:GRADES2NDSEM.subj_2ndsem := studgrade2nd_rec.subj_code;
:GRADES2NDSEM.desc_2ndsem := studgrade2nd_rec.description;
:GRADES2NDSEM.units_2ndsem := studgrade2nd_rec.units;
:GRADES2NDSEM.grade_2ndsem := studgrade2nd_rec.grade;
NEXT_RECORD;
END IF;
END IF;
:SYSTEM.MESSAGE_LEVEL := '5';
Up;
END LOOP;
--:SYSTEM.MESSAGE_LEVEL := '5';
--Up;
--IF NOT FORM_SUCCESS THEN
-- Message('');
--END IF;
--:SYSTEM.SUPPRESS_WORKING := 'TRUE';
END;
[Updated on: Sun, 19 February 2012 04:01] Report message to a moderator
|
|
|
Re: records not displaying in a specific text item [message #544015 is a reply to message #543777] |
Sun, 19 February 2012 04:37 ![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) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
cookiemonster wrote on Thu, 16 February 2012 21:30You need to learn to debug such code.
Put messages inside each for loop to display the subject code currently selected.
Also display system.cursor_record and system.current_block.
Work out exactly what it is doing at each point.
And add some scroll bars.
There is nothing obviously wrong in the code. So you need to debug it. We can't do that for you and it's a basic skill you need to learn.
|
|
|
|
|
Re: records not displaying in a specific text item [message #544056 is a reply to message #544052] |
Sun, 19 February 2012 13:03 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Quote:I saw this debug console and click on the stack.
You clicked on the stack ... why? How come you didn't click something else?
Anyway: first you have to set a breakpoint in a PL/SQL unit. Once form execution reaches that point, it will stop and open debugger console. Get familiar with what it offers.
Toolbar contains several debugging buttons; you are supposed to advance through your code step by step (i.e. line by line / statement by statement) and - using the debugger console - watch what has been done, what are system and user's variables values, collect knowledge which will - hopefully - lead you to solution of the problem.
As of SYSTEM variables you mentioned: they are explained in Forms Help System - open it, search, read.
|
|
|