Home » Developer & Programmer » Forms » Records navigation problem
Records navigation problem [message #154048] Thu, 05 January 2006 08:41 Go to next message
karan.shandilya
Messages: 64
Registered: July 2005
Location: mumbai
Member
Hi to all.
I am facing the records navigation problem in my form which has two blocks
1: employee_hist_1
2: employee_hist;

I am writing the code of when-button-pressed TRIGGER which is on block 1st.
After taking the value in search_criteria field when i press this button
2nd block shows the matching records.

But when there are more then one records for search_criteria value it ONLY SHOWS
one record.


THE CODE IS------




:global.dat:=:employee_hist_1.search_criteria;

Declare
A number;
CURSOR Cursorss
Is SELECT first_name,rank,name,desig,job_code
WHERE upper(first_name)=upper(:global.dat) OR
upper(middle_name)=upper(:global.dat) OR
upper(last_name)=upper(:global.dat);

BEGIN

IF upper (:employee_hist_1.search_criteria) is null THEN
A:=show_alert('alert50');
message('Field is Empty');
RAISE Form_Trigger_Failure;
END IF;
OPEN Cursorss;
First_record;
Loop
Fetch cursorss into :employee_hist.first_name,
:employee_hist.rank,:employee_hist.name,:employee_hist.desig,:employee_hist.job_code;

EXIT When Cursorss%NOTFOUND;
Next_Record;
End LOop;
Close Cursorss;
END;
First_Record;
Erase(:global.dat);

GO_BLOCK('employee_hist');



So please tell me where i am wrong.

Karan.
Re: Records navigation problem [message #154051 is a reply to message #154048] Thu, 05 January 2006 08:50 Go to previous messageGo to next message
vakkalan
Messages: 20
Registered: January 2006
Location: US
Junior Member

Karan,
I would like to understand the problem a bit more, may be you can do the below and get back, which may help you find the solution.

1. Put a pause after your FETCH and see if the cursor is fetching more than one record and rewriting the current record in the loop;
2. Also gen in my search criteria i use like with % for all combination matches.

Let me know what you come up with.

HARSHA VAKKALANKA
Re: Records navigation problem [message #154129 is a reply to message #154048] Thu, 05 January 2006 16:53 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please format your code when posting. It makes it much easier to read. See http://www.orafaq.com/utilities/sqlformatter.htm

David
Re: Records navigation problem [message #154337 is a reply to message #154051] Sat, 07 January 2006 01:11 Go to previous messageGo to next message
karan.shandilya
Messages: 64
Registered: July 2005
Location: mumbai
Member
Hi Harsha,
Thanx to you for your help. Here i am elaborate my previous message.
I am using two 2 canvas for each blocks. On one canvas there is one 'search_criteria' text item and a button, code for button i already wrote in my previous message.
Now when the button is pressed focus goes to second block(2nd canvas) which has fields which i wrote in code.

My form shows only a single record for 'search_criteria' field eventhough it has more then one record.

Now I hope that you will find out solution.

Karan.


Re: Records navigation problem [message #154338 is a reply to message #154129] Sat, 07 January 2006 01:16 Go to previous messageGo to next message
karan.shandilya
Messages: 64
Registered: July 2005
Location: mumbai
Member
Hi David,
I am getting this error while formatting my code.

Error Messages
:global(1,1) expected token:Error when tokenlize
First_Record(28,1) expected token:Unknown



Karan.
Re: Records navigation problem [message #154384 is a reply to message #154338] Sat, 07 January 2006 15:11 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It seems that, when you press the button, the FOCUS stays in the first block (that is, the block to which the button belongs). The code you've written seems to be OK; just move the last line to be the first one.

NO
:global.dat:=:employee_hist_1.search_criteria;
Declare ...

YES
GO_BLOCK('employee_hist');

:global.dat:=:employee_hist_1.search_criteria;
Declare ...
Re: Records navigation problem [message #154466 is a reply to message #154048] Sun, 08 January 2006 18:02 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
There is no 'FROM table_name' in your cursor select statement.

I also suggest that your ALWAYS start your trigger code with a DECLARE or a BEGIN and end it with an END.

David

[Updated on: Sun, 08 January 2006 18:04]

Report message to a moderator

Re: Records navigation problem [message #155049 is a reply to message #154384] Wed, 11 January 2006 23:43 Go to previous message
karan.shandilya
Messages: 64
Registered: July 2005
Location: mumbai
Member
Thanx Little Foot.
You are absoluetly right.
I got the solution.

Thanx DAVID.

Karan.



Previous Topic: Minimizing all Forms
Next Topic: FRM-10054 cann't attach PL/SQL library
Goto Forum:
  


Current Time: Fri Sep 20 04:47:39 CDT 2024