Home » Developer & Programmer » Forms » Moving between records in a multi-record block (merged 10) (Form Builder 5.0.6, Windows XP)
Moving between records in a multi-record block (merged 10) [message #426110] Wed, 14 October 2009 02:29 Go to next message
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 #426128 is a reply to message #426110] Wed, 14 October 2009 03:07 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Are the buttons on the same (control) block?

MHE
Re: Moving between records in a multi-record block (merged 10) [message #426129 is a reply to message #426128] Wed, 14 October 2009 03:10 Go to previous messageGo to next message
Abou ddan
Messages: 6
Registered: October 2009
Location: Lebanon
Junior Member
Yes
Re: Moving between records in a multi-record block (merged 10) [message #426156 is a reply to message #426129] Wed, 14 October 2009 04:03 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Ok, then we'll need to know what 'is not working' means. It might appear that you won't change records since the focus is on the button. What happens is you set the "mouse navigate" property to FALSE?

Note: just a thought, I didn't test or check anything.

MHE
Re: Moving between records in a multi-record block (merged 10) [message #426161 is a reply to message #426156] Wed, 14 October 2009 04:23 Go to previous messageGo to next message
Abou ddan
Messages: 6
Registered: October 2009
Location: Lebanon
Junior Member
Let's say that the form is Like This:

ID:...
NAME:...

[<] [>]



When populating the initial Data, I am using the cursor to fill the block. When I press the button 'next', Nothing happens. I want to navigate the block. When I press next It must shows me the next record...Keeping in mind that the Number Of records Displayed: 1.

[Updated on: Wed, 14 October 2009 04:23]

Report message to a moderator

Re: Moving between records in a multi-record block (merged 10) [message #426172 is a reply to message #426110] Wed, 14 October 2009 04:49 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
What does the record count at the bottom of the screen show? Does it say there are 5 records?

Do you get any form of message when you try to do next_record?
Re: Moving between records in a multi-record block (merged 10) [message #426183 is a reply to message #426172] Wed, 14 October 2009 05:39 Go to previous messageGo to next message
Abou ddan
Messages: 6
Registered: October 2009
Location: Lebanon
Junior Member
No, Nothing.
In this particular Form I have No Status Bar at the Buttom.
Re: Moving between records in a multi-record block (merged 10) [message #426185 is a reply to message #426110] Wed, 14 October 2009 05:44 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You haven't got a status bar? how did you manage that?
Things might be easier if got the status bar back.
Also what is your :system.message_level set to? Try setting it to 0 if it isn't already.
Re: Moving between records in a multi-record block (merged 10) [message #426188 is a reply to message #426185] Wed, 14 October 2009 06:00 Go to previous messageGo to next message
Abou ddan
Messages: 6
Registered: October 2009
Location: Lebanon
Junior Member
This Is a Window Form That pops up on another Form.
The :system.message_level is already set to 0.
But what does it change?
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 Go to previous messageGo to next message
cookiemonster
Messages: 13938
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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:


  1. Non-database ('control') block
  2. 5 records displayed
  3. 2 text items (col1 - number - and col2 - varchar2)
  4. 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 1085 times)
Re: Moving between records in a multi-record block (merged 10) [message #428322 is a reply to message #426538] Tue, 27 October 2009 19:33 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
The 'next_record' does nothing at open time because you are at the last record. Put a 'first_record' after the loop to take you back to the 'top'.

David
Previous Topic: Pre-Insert trigger doesn't fire
Next Topic: Remove browser bar from the runtime form view
Goto Forum:
  


Current Time: Fri Sep 20 06:39:54 CDT 2024