Moving between records in a multi-record block (merged 10) [message #426110] |
Wed, 14 October 2009 02:29 |
Abou ddan
Messages: 6 Registered: October 2009 Location: Lebanon
|
Junior Member |
|
|
Hi
I am trying to navigate in a non-database multi-record block using Form Builder 5.0.6.
This block is filled Manualy:
1- First a Cursor:
CURSOR C1 IS
SELECT ID
, NAME
FROM PAYERS;
2- Filling the Block:
OPEN C1;
GO_BLOCK('BLK_PAYERS');
FIRST_RECORD;
WHILE TRUE LOOP
FETCH C1 INTO :BLK_PAYERS.ID
,:BLK_PAYERS.NAME;
EXIT WHEN C1%NOTFOUND;
NEXT_RECORD;
END LOOP;
3- I have 2 Buttons. The first one 'Next' displayes the next record, having in code ='Next_record;'
and the second button 'Previous' Displayes the privious record, having in code ='Previous_Record;'
The problem is: using these two buttons for navigating the block is not working. So how can I navigate the block using buttons?
PS: I must use these properties:
Number Of records Buffered: 5
Number Of records Displayed: 1.
Many Thanks. [EDITED by DJM: removed poxy formatting, add 'codes' tags]
[Updated on: Tue, 27 October 2009 19:19] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Re: Moving between records in a multi-record block (merged 10) [message #426212 is a reply to message #426110] |
Wed, 14 October 2009 07:17 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
message_level suppress some messages - one of which might have told us what the problem is. But you've got it set to not suppress anything.
Basically this'll be down to one of two issues:
1) It never actually created 5 records in the first place.
2) Something is preventing you changing record.
In either case I'd expect an error message to appear somewhere.
Have you got any code in either the on-message or on-error triggers?
I'd seriously consided changing your form to get the status bar back untill we've worked out what the problem is. It's going to be pretty hard to debug without it.
One thing you could do is put a message in the cursor loop that populates the block in the first place. Have it show the current record number. Then we can check that five records are actually being created.
|
|
|
Re: Moving between records in a multi-record block (merged 10) [message #426358 is a reply to message #426212] |
Thu, 15 October 2009 01:23 |
Abou ddan
Messages: 6 Registered: October 2009 Location: Lebanon
|
Junior Member |
|
|
Many thanks for your help
I first doubted that it never actually created The records
So What is the better way to create them?
Is Next_record enough?
Is there anything missing before 'Next_Record'?
And speaking on 'Something is preventing you changing record'
Is there any option or property Modification I should do on the Block?
|
|
|
Re: Moving between records in a multi-record block (merged 10) [message #426538 is a reply to message #426358] |
Fri, 16 October 2009 07:16 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
I was somewhat puzzled by your question and decided to test it myself (yes, I occasionally do that). Here's the test case:
1. Table Creation script:
Create Table MHE_TEST(col1 number, col2 VARCHAR2(30))
/
Insert Into MHE_TEST( col1, col2)
Select LEVEL
, TO_CHAR(TO_DATE(LEVEL,'J'), 'Jsp')
From dual
Connect by level < 31
/
Commit
/ I've also created a form (see attach) in Oracle Forms Builder 6i. This form has a block (CONTROLBLOCK) with the following properties:
- Non-database ('control') block
- 5 records displayed
- 2 text items (col1 - number - and col2 - varchar2)
- 2 buttons (bt_prev, bt_next)
I have created a WHEN-NEW-FORM-INSTANCE trigger with the following code:
Declare
Cursor c1
Is
Select col1
, col2
From mhe_test;
Begin
Open C1;
Go_Block('CONTROLBLOCK');
First_Record;
While TRUE Loop
Fetch C1 Into :CONTROLBLOCK.COL1, :CONTROLBLOCK.COL2;
Exit When C1%NOTFOUND;
Next_Record;
End Loop;
End;
Then I've added a WHEN-BUTTON-PRESSED trigger on the buttons: one to navigate to the previous record and one to navigate to the next record.
This simple form works as suspected. You can test it yourself.
Perhaps we're missing something here but I hope it might help just a little bit.
MHE
-
Attachment: test.fmb
(Size: 52.00KB, Downloaded 1092 times)
|
|
|
|