Oracle Forms question

anumoses
anumoses used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Database Administrator
Commented:
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?

Author

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

Author

Commented:
attaching some screen printsscre1n1screen1screen2
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

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.

Author

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-specialist

Commented:
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 ?

Author

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);

Author

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-specialist

Commented:
Where is the cursor staying ?
Mark GeerlingsDatabase Administrator

Commented:
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 Administrator

Commented:
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 Administrator

Commented:
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?

Author

Commented:
Thanks experts. I was able to get this taken care.
Mark GeerlingsDatabase Administrator

Commented:
Are you willing to help anyone else learn from what you found?  Can you explain how you got this taken care of now?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial