Home » Developer & Programmer » Forms » Go to Specific Record
Go to Specific Record [message #671059] Mon, 13 August 2018 08:58 Go to next message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
I want to go to specific record what i have queried
Block Property Set to > No of records Display '20'
its up to 1000 records with Scrollbar

I want to create a Find button that show LOV then %search my result and when i press Ok then bring me to that row

Like Last_Record, First_Record
Begin
   first_record;
   Loop
      null;
      if :system.last_record = 'TRUE' then
         exit;
      End if;
      next_record;
   End Loop;
   first_record;
End;
Re: Go to Specific Record [message #671074 is a reply to message #671059] Tue, 14 August 2018 06:50 Go to previous messageGo to next message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
I have 2 Block Block1 and Block2
In Block1- 2 Column Column1 (Primary Key Set to Yes) and Column2 (Block1 Property Set to > No of records Display '20')
and 1 Button (Display Set to 1)
Query Data Source Type-- FROM clause query and Query Data Source Name-- SELECT * FROM DUAL;
In Block2- 1 Column Search


When-New-Form-Instance
DECLARE
	v_query VARCHAR2(50);
BEGIN
	v_query := '(SELECT code, name FROM mast)';
	Set_Block_Property('Block1', QUERY_DATA_SOURCE_NAME, v_query);
	Execute_Query;
END;
When-Button-Pressed
DECLARE
	v_query VARCHAR2(50);
BEGIN
	IF :Search IS NOT NULL THEN
		First_Record;
		LOOP
			Next_Record;
			EXIT WHEN :SYSTEM.CURSOR_VALUE LIKE :Search;
			EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
		END LOOP;
	ELSE
		Raise Form_Trigger_Failure;
	END IF;
END;
But i want to search by LOV Button

Using LOV button %Search for record and when click Ok then

FRM-40501 ORACLE error unable to reserve record for update or delete
ORA-00903 invalid table name

Maybe problem in Column Maping Properties but I dont know how to overcome

Any hint...
Re: Go to Specific Record [message #671075 is a reply to message #671074] Tue, 14 August 2018 08:02 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Which block is :search in?
Is that block based on a table?
Re: Go to Specific Record [message #671076 is a reply to message #671074] Tue, 14 August 2018 08:31 Go to previous messageGo to next message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
Now SELECT * FROM DUAL; Replace by Table Name 'mast' and those Errors disappeared

Still problem in Column Maping Properties, when press Ok on LOV it replace the Current Cursor position

I want to jump on that row not Map on Current Cursor position
Re: Go to Specific Record [message #671077 is a reply to message #671075] Tue, 14 August 2018 09:26 Go to previous messageGo to next message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
Quote:
Which block is :search in?
Block2
Quote:
Is that block based on a table?
No.

I dont want :Search by textbox i want LOV to search
Re: Go to Specific Record [message #671078 is a reply to message #671077] Tue, 14 August 2018 09:39 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
You might want to do it via LOV but LOVs aren't really designed for this job.
To use an LOV the LOV is going to have to be attached to a non-database item - it has to return a value for you to work with and that value has to go somewhere.
If you put it in a datablock item then forms will think you changed data when you didn't want to.

So the LOV needs to be attached to search and you should be able to put your when-button-pressed code in key-listval. You'll need to add code to call the LOV and then change the block that holds the queried data.
Re: Go to Specific Record [message #671079 is a reply to message #671078] Tue, 14 August 2018 14:23 Go to previous messageGo to next message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
When-New-Form-instance
DECLARE
	CURSOR c1 IS
	SELECT * FROM Test_Table;
BEGIN
	Clear_Block(No_Validate);
	First_Record;
	FOR i IN c1
	LOOP
		:Block1.Code := i.Test_Code;
		:Block1.Name := i.Test_Name;
		Next_Record;
	END LOOP;
	First_Record;
END;
When-Button-Pressed Bring me to another Window/Canvas
Show_View('Canvas2');
Go_Item('Block2.Code');
DECLARE
	CURSOR c1 IS
	SELECT * FROM Test_Table;
BEGIN
	Clear_Block(No_Validate);
	First_Record;
	FOR i IN c1
	LOOP
		:Block2.Code := i.Test_Code; --Block 2
		:Block2.Name := i.Test_Name; --Block 2
		Next_Record;
	END LOOP;
	First_Record;
END;
Here I desined Modal Window Look Like LOV Where i search my result from 1000 result to 5, now from 5 i selected a result
Is it possible to hold my CURSOR_VALUE into a Variable or Global Variable and pass to below "EXIT WHEN :SYSTEM.CURSOR_VALUE = ???"
When-Button-Pressed
BEGIN
  Show_View('Canvas1');
  Go_Item('Block1.Code');
  First_Record;
  LOOP
    EXIT WHEN :SYSTEM.CURSOR_VALUE = ???????????;
    EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
    Next_Record;
  END LOOP;
END;

Last one is edited because that was not making any sense, Please Help me on this.

[Updated on: Wed, 15 August 2018 11:42]

Report message to a moderator

Re: Go to Specific Record [message #671116 is a reply to message #671079] Wed, 15 August 2018 13:33 Go to previous message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
Done...
Button Property Mouse Navigate Set to 'No'
Begin
:Global.Val := :SYSTEM.CURSOR_VALUE;
Show_View('Canvas1');
Go_Item('Block1.Code');
LOOP
	EXIT WHEN :SYSTEM.CURSOR_VALUE = :Global.Val;
	Next_Record;
	EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
END LOOP;
End;
Previous Topic: Excel/File Download
Next Topic: How to create login form.(merged)
Goto Forum:
  


Current Time: Thu Mar 28 14:39:37 CDT 2024