Oracle Forms question

I have this code

I want to go to the block.field but its not working

 forms_ddl('begin DBMS_TRANSACTION.COMMIT; end;');

                                go_block('vendor_invoice_items'); 
		     	           clear_block(no_validate);
		     	         go_block('vendor_invoices');
		                  clear_block(no_validate);
		                  clear_form(no_validate);
		                 go_block('vendor_invoices');
		                 go_item('vendor_invoices.dsp_order_number');
		                   :SYSTEM.MESSAGE_LEVEL := 25; 

Open in new window

LVL 6
anumosesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark GeerlingsDatabase AdministratorCommented:
Since you have a "clear_form" on line 7, why bother doing two explicit "clear_block" commands first?  The "clear_form" will do the clear block actions anyway.

Line 1 also looks very complex.  Why is that not a simple: "commit;" or "commit_form;"?  Or, do you explicitly want to only commit any POST actions the form may have done, but not actually have the form do its normal commit processing?

You shouldn't need both a "go_block" and a "go_item".  Just a "go_item" should be enough.  And you may not even need that, since these both follow the "clear_form" command.  That should put the cursor into the first field of the first block of this form.  We have no way of knowing which block and which field that is.  Can you tell us if that first block is "vendor_invoices"?  Also, is the "dsp_order_number" a user-enterable field in the form?  Or, is that maybe a display-only field?

When you say "its not working" what exactly does it do or not do?  Where (in which field of which block) does the cursor end up in now at the end of this trigger?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anumosesAuthor Commented:
Let me give the complete code. I am populating a message(alter)

Here is the code.

Users enter invoice header and they save the header. Then enter lines. Invoice is out of balance. Then I populate message to correct lines or delete invoice. If delete invoice then I have this code.


 
	answer := show_alert('NO_LINES_WARN');
		     IF answer=ALERT_BUTTON1 then
		     	  go_block('vendor_invoice_items');
		            raise form_trigger_failure;
		     ELSIF answer = ALERT_BUTTON2 THEN  
		     	  select count(*) into v_count
		     	    from dss.vendor_invoices
		     	   where invoice_no =  :vendor_invoices.invoice_no;
		     	  If v_count = 1 then
		     		 select id 
		     		   into v_inv_id
		     		   from dss.vendor_invoices
		     		  where invoice_no = :vendor_invoices.invoice_no;
		     		   	go_block('vendor_invoice_items');
		     		   		first_record;
                  Loop
                  	delete_record;
                  	If :system.last_record = 'TRUE' Then
                     Exit;
                    End If;
                     next_record;
                  End Loop;
		     		  delete from dss.vendor_invoices
		     		   where id = v_inv_id;	     		  
		     	  end if;

                 forms_ddl('begin DBMS_TRANSACTION.COMMIT; end;'); 

                  go_block('vendor_invoice_items'); 
                     delete_record;
		     	           clear_block(no_validate);
		     	         go_block('vendor_invoices');
		                  clear_block(no_validate);
		                  clear_form(no_validate);
		                  go_block('vendor_invoices');
		                  go_item('vendor_invoices.dsp_order_number');

Open in new window

anumosesAuthor Commented:
attaching some screen printsscre1n1screen1screen2
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

anumosesAuthor Commented:
	answer := show_alert('NO_LINES_WARN');
		     IF answer=ALERT_BUTTON1 then
		     	  go_block('vendor_invoice_items');
		            raise form_trigger_failure;
		     ELSIF answer = ALERT_BUTTON2 THEN  
		     	  select count(*) into v_count
		     	    from dss.vendor_invoices
		     	   where invoice_no =  :vendor_invoices.invoice_no;
		     	  If v_count = 1 then
		     		 select id 
		     		   into v_inv_id
		     		   from dss.vendor_invoices
		     		  where invoice_no = :vendor_invoices.invoice_no;
		     		   	go_block('vendor_invoice_items');
		     		   		first_record;
                  Loop
                  	delete_record;
                  	If :system.last_record = 'TRUE' Then
                     Exit;
                    End If;
                     next_record;
                  End Loop;
		     		  delete from dss.vendor_invoices
		     		   where id = v_inv_id;	     		  
		     	  end if;

                 commit_form;
                    :SYSTEM.MESSAGE_LEVEL := 25; 
                  go_block('vendor_invoice_items'); 
                     delete_record;
		                  clear_form(no_validate);
		                  go_item('vendor_invoices.dsp_order_number');

Open in new window


Even this does not go to the order_number field.
anumosesAuthor Commented:
I added this message

 message ('here is the cursor(2)  - '||:SYSTEM.CURSOR_ITEM);pause;

The message gives me the dsp_order_number field but loses visibility. How to fix this?
flow01IT-specialistCommented:
2 questions
1) What do you mean by 'loses visibility'  ?  
Do you mean you can't see the dsp_order_number (i assume it's the item to the right of 'Order/Type')  or is it empty ?

2) 'Even this does not go to the order_number field'  
What item does it go to?  

With the clear_form I expect all items to be empty.  Did you really want to clear_block ?
anumosesAuthor Commented:
I know the form in in changed status. I need to get the form in insert status. Can I use

 Set_Record_Property (NAME_IN ('SYSTEM.TRIGGER_RECORD'),
                        NAME_IN ('SYSTEM.TRIGGER_BLOCK'),
                        STATUS,
                        INSERT_STATUS);
anumosesAuthor Commented:
I used these message

                                message(  'System.Block_Status='  || :System.Block_Status);pause;
                            message( 'System.Record_Status=' || :System.Record_Status);pause;

In both messages the result is NEW. Not sure why is the cursor not staying in the dsp_order_number field.
flow01IT-specialistCommented:
Where is the cursor staying ?
Mark GeerlingsDatabase AdministratorCommented:
These actions:
  delete_record;
  next_record;
  commit_form;
will all move the cursor to the first user-enterable field in the block.  Which field is that?  We cannot determine that from screen shots.  You can determine that in Forms Builder.
 
Can the user ever get the cursor into the dsp_order_number field manually?

Which field does the cursor end up in now?
Mark GeerlingsDatabase AdministratorCommented:
I have never found a reason to manipulate the block_status value manually.  Are you sure that you cannot use the default commit processing in Oracle Forms to manage the block_status automatically for you?
Mark GeerlingsDatabase AdministratorCommented:
Can you give us any information on where the cursor goes now at the end of this trigger/procedure?  And, can you confirm that the user can get the cursor into the dsp_order_number field manually?
anumosesAuthor Commented:
Thanks experts. I was able to get this taken care.
Mark GeerlingsDatabase AdministratorCommented:
Are you willing to help anyone else learn from what you found?  Can you explain how you got this taken care of now?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.