Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to assign values to the item where currently the cursor is??

2685465Aug 1 2014 — edited Aug 19 2014

Hello All,

I have one 'tabular' data block ,B_Emp (from the table Employee) and one non-database & non-tabular block B_Test consisting of some text_items.

'Emp_id' is one of the column of the Employee table and I want to assign all the values of the Emp_id  in all the text_items of the B_Test sequentially,when one particular button is pressed.

Here's what I have written in the trigger

Declare

  i number;

  l_last_record number;

  next varchar2(40); ---- to hold the values of  system cursor of the next item in the B_Test block

  next_r varchar2(40); --- to hold the values of system cursor of the the next record in the B_Emp block

Begin

go_block('B_Emp');

Set_Block_Property('B_EMPLOYEES_ALL', DEFAULT_WHERE, 'Emp_id is not null');

  execute_query(no_validate);

  last_record;

  l_last_record := :system.cursor_record;

  first_record;

  next_r := :SYSTEM.CURSOR_ITEM;

  go_block('B_Test');

  next := :SYSTEM.CURSOR_ITEM;

  for i in 1..l_last_record

  Loop

       go_item(next);

      :next := :B_Emp.Emp_id; ---- here is the problem

       next_item;

       next := :SYSTEM.CURSOR_ITEM;

       go_item(next_r);

       next_record;

       next_r:= :SYSTEM.CURSOR_ITEM;

   EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';

  End Loop;

End;

Now this gives me the expected error of Bad Bind Variable as there is no data block with the name 'next'.

However I have checked the value of  'next' and 'next_r' (message('next value= '||next) )and I am getting the expected values.

So if somehow I am able to insert my value in the current cursor item(because in the beginning of the loop my system cursor is exactly at the text item where i need to insert the value) then i don't have to use this " :next := :B_Emp.Emp_id;"

           OR

If somehow I am able to refer the items in my B_test block dynamically then i can simply use

Loop

:B_test.''dynamic reference for the item" := :B_Emp.Emp_id;

next_record;

EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';



Please help me out of this!!

This post has been answered by 2685465 on Aug 19 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2014
Added on Aug 1 2014
13 comments
10,903 views