Home » Developer & Programmer » Forms » Execute Query (forms 12cR4 Database 12c)
Execute Query [message #681044] Tue, 09 June 2020 06:26 Go to next message
sarah1992
Messages: 5
Registered: June 2020
Junior Member
hi all

I am using forms 12R4 Database 12c.

I am using the following execute query its working and executing the query but its not giving the same record.

When I put no 12 to execute query along with other record its executing but cursor does not go to the same searched record.

Here is the code:
DECLARE
    blk_id Block;
BEGIN

    blk_id := Find_Block('first_block1');

    IF NOT Id_Null(blk_id) THEN
       IF (:first_block1.ID_no is not null) THEN
          SET_BLOCK_PROPERTY(blk_id,DEFAULT_WHERE,'ID_No=' || :second_block.ID_no);
          GO_block('weqaya_insurance');
          EXECUTE_QUERY;
       END IF;
    END IF;

    IF :System.Last_Record <> 'TRUE' THEN
       LAST_RECORD;
    ELSE
       FIRST_Record;
    END IF;
END;
Note: If I enter no 12 and press then button to execute query so my cursor should be on 12 no not in last or first record, Is it possible?

Please guide me.


[EDITED by LF: fixed code, applied [code] tags]

[Updated on: Tue, 09 June 2020 11:53] by Moderator

Report message to a moderator

Re: Execute Query [message #681051 is a reply to message #681044] Tue, 09 June 2020 11:58 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I think you're mistaken. DEFAULT WHERE clause you used:
WHERE ID_No = :second_block.ID_no
will return all rows from the source table whose ID_NO = 12 (which you used as example). It doesn't mean that - after executing a query - Forms will jump to the 12th row in the block. What if there are only 3 rows fetched? How would you jump to the 12th row, then?

If you want to do what you described, then DEFAULT WHERE clause is more or less useless, but you should use GO_RECORD (in the same WHEN-BUTTON-PRESSED trigger), e.g.

go_block('first_block');
execute_query;
go_record(:second_block.id_no);

Or: I completely misunderstood what you are asking so what I wrote doesn't make sense.
Re: Execute Query [message #681056 is a reply to message #681051] Wed, 10 June 2020 01:03 Go to previous messageGo to next message
sarah1992
Messages: 5
Registered: June 2020
Junior Member
Hi,

Thanks a lot for helping me.

Actually you got me right. I want to execute query using Main block along with sub block. when i enter 12 in sub block after pressing button records should be dipslayed
after showing record my cursor should be on the 12 record or it should hightlight with any color..

Note:- i am using tubular form


sub block------------ i have one text item and one when press button i enter value here
main block. executing here.


Notes: i want to find value 12 my cursor should be on 12 and if there is more 12 that should be highlighted too.

[Updated on: Wed, 10 June 2020 03:41]

Report message to a moderator

Re: Execute Query [message #681065 is a reply to message #681056] Wed, 10 June 2020 09:21 Go to previous message
sarah1992
Messages: 5
Registered: June 2020
Junior Member
I solved my problem...

here is the code, what i was looking for....

SET_BLOCK_PROPERTY('first_block',DEFAULT_WHERE,
'ID_no=' ||:Search_sub_block.ID_no);
go_block('first_block');
execute_query;
SET_BLOCK_PROPERTY('first_block',DEFAULT_WHERE, '');
Previous Topic: Form personalization
Next Topic: User Access on different Modules(forms)
Goto Forum:
  


Current Time: Thu Mar 28 05:56:48 CDT 2024