Home » Developer & Programmer » Forms » Forms (FORMS 6i)
Forms [message #523310] Fri, 16 September 2011 12:04 Go to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
SQL Plus version Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production
PL/SQL Release 8.0.5.1.0 Production
Forms Version : 6i
Reports Version: 6i
O/S : Microsoft Windows Xp professional Version 2002 Service Pack 3

Hi
With reference to the above version details here is the requirement.

How do I restrict user on key next item trigger i.e I want the cursor to move to next field only when user presses "ENTER" button on the key board any other key like mouse should not allow user to move to the next field.

Any help will be much appreciated.
Regards
Zahid
Re: Forms [message #523315 is a reply to message #523310] Fri, 16 September 2011 12:42 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
What about making the field ENABLED = NO and then enabling it upon leaving the first field, then making it disabled again once they leave that field?
Re: Forms [message #523320 is a reply to message #523315] Fri, 16 September 2011 13:19 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
Thanks for your reply. Couldn't understand your reply please elaborate.
Let me be more precise. This text item has a key-next-item trigger associated with it which checks for duplicate records. i.e it displays all records that exist on the entered post code, thereby avoids any duplicate record living on the same post from entering the database,and the trigger reads like this

[/PACKAGE BODY blk_contacts IS

PROCEDURE NAME(event varchar2) IS

 BEGIN
 	
 	if event IN ('KEY-NEXT-ITEM','KEY-DOWN') then
 		init;
 		go_item('tbl_Contact.Contact_address');
 		set_item_property('button_bar.psave',enabled,property_true);
 	elsif
 		event IN ('KEY-UP','KEY-PREV-ITEM') then
 		go_item('tbl_Contact.Contact_title');
 	end if;
 
 END NAME;
 
PROCEDURE PCODE(event varchar2) IS
		
	var number(5);
	alr_dup number(5);
	
	BEGIN
		If event IN ('KEY-NEXT-ITEM','KEY-DOWN') then
			if :tbl_contact.contact_pcode is not null then
				select count(contact_pcode) into var 
				from ihelp.tbl_contact 
				where contact_pcode=:tbl_contact.contact_pcode
				and contact_code<>:tbl_contact.contact_code;
				if 	var>0 then
					show_window('win_dup');
					go_block('vew_dup');
					 set_block_property('vew_dup',default_where,'upper(ltrim(rtrim(contact_pcode)))='||upper(ltrim(rtrim(''''||:tbl_contact.contact_pcode| |''''))));
					execute_query;
					go_item('vew_dup.NB');
				else
					go_item('tbl_Contact.Contact_title');
				end if;
				else
					go_item('tbl_Contact.Contact_title');
				end if;
				
			elsif event IN ('KEY-PREV-ITEM','KEY-UP') then
				go_item('tbl_contact.active');
			end if;
		
	END PCODE;
	
END BLK_CONTACTS;--end package]

Please provide your further help on this. The requirement is only user can move with the enter Key from the keyboard any other key should not take user to the next item including mouse click
Regards
Zahid.

[Updated on: Fri, 16 September 2011 15:07] by Moderator

Report message to a moderator

Re: Forms [message #523336 is a reply to message #523320] Fri, 16 September 2011 15:14 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Set the field ENABLED property to NO on the field you do not want to allow user to go to.

On KEY-NEXT-ITEM of previous field, do whatever checks you have to do, then set the ENABLED property of the non-enabled field you want to go to YES (and possibly INSERT ALLOWED and UPDATE ALLOWED property as well). Then add the NEXT-ITEM as the last item in the trigger.

When you leave the field restricted field, set the ENABLED property back to NO so no one can get there unless they use the [enter] key from the previous field of that field.

This is all just a guess however.
Re: Forms [message #523661 is a reply to message #523336] Mon, 19 September 2011 12:44 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
Thanks for that

I am thinking like this
[/if ASCII('BUFFER') <> '13' then
	Message ('Press Enter Key to Proceed');
	Message ('Press Enter Key to Proceed');
	raise form_trigger_failure;
else
	NEXT_ITEM;
	end if;

above code compiles successfully and displays the message even when the user has pressed ENTER KEY (I believe the ASCII value for Enter is 13)

[Updated on: Mon, 19 September 2011 13:09] by Moderator

Report message to a moderator

Re: Forms [message #523681 is a reply to message #523661] Mon, 19 September 2011 18:06 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is there a particular reason why you want to prevent the users from using tab to get to the next item?
Re: Forms [message #523831 is a reply to message #523681] Tue, 20 September 2011 09:12 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
Yes, As I mentioned earlier that the key-next item and key down associated with text item "Contact_Pcode" have trigger written which checks for duplicate Post code i.e say for e.g: if A person lives on B12 8XD and person B also lives on the same post code, the associated trigger fires and show list of all person that lives on the same post code. Assuming the scenario above if a new contact comes for entry and his/her name is A or B sharing same door number, road/street name will cause duplication in the database. i.e two ID's get created for the same person. This is evident because users don't bother to press the Enter key,in fact use mouse to move down to the next field and the associated trigger does not get the chance to fire.

Please reply.
Re: Forms [message #523833 is a reply to message #523831] Tue, 20 September 2011 09:23 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) You could just add code to when-validate-item or when-validate-record to check for dupes.
This wouldn't allow automatic querying of the existing data, but would ensure they can't enter dupes no matter what.
2) You could turn mouse navigable off.
3) enter does the same thing as tab - causes key-next-item to fire - hence my question.
Regardless you can't check to see if the user has pressed enter explicitly - the field isn't set to enter,
enter (and tab) causes the trigger to fire.
SQL [message #524053 is a reply to message #523310] Wed, 21 September 2011 09:44 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
SQL Plus version Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production
PL/SQL Release 8.0.5.1.0 Production
Forms Version : 6i
Reports Version: 6i
O/S : Microsoft Windows Xp professional Version 2002 Service Pack 3


Please refer to the attachment for actual query which says ora- 01843 (Not a valid month)
  • Attachment: post.JPG
    (Size: 110.43KB, Downloaded 657 times)
Re: SQL [message #524062 is a reply to message #524053] Wed, 21 September 2011 10:50 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Don't post something from sqlplus as a screenshot. Copy and paste the text directly, in code tags, as described here:
How to use [code] tags and make your code easier to read?
Re: SQL [message #524070 is a reply to message #524062] Wed, 21 September 2011 12:44 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
to_char(to_date(receipt_detail_month||' '||receipt_detail_year,'Month rrrr'),'Mon rrrr') receipt_month,


What if you did:
to_char(to_date(''''||receipt_detail_month||' '||receipt_detail_year||'''','Month rrrr'),'Mon rrrr') receipt_month,


[uh-oh]
Sorry, I don't know how I did it, but somehow I deleted your part of the message with the error (when I thought I was making a response to the message). However, try my solution to see if it works.

[Updated on: Wed, 21 September 2011 12:56] by Moderator

Report message to a moderator

Re: SQL [message #524087 is a reply to message #524070] Wed, 21 September 2011 14:15 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
Instead of this
to_char(to_date(''''||receipt_detail_month||' '||receipt_detail_year||'''','Month rrrr'),'Mon rrrr') receipt_month


I tried
to_char(to_date(''||receipt_detail_month||' '||receipt_detail_year||'','Month rrrr'),'Mon rrrr') receipt_month,

worked fine when restricted the query to where clause in SQL Plus by specifying a receipt_code, but unfortunately didn't work in Report builder throws the same error

ORA- 01843 Not a valid month.
Re: SQL [message #524088 is a reply to message #524087] Wed, 21 September 2011 14:24 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What distinct values does RECEIPT_DETAIL_MONTH contain? It seems that at least one value is not a valid month.
Re: SQL [message #524093 is a reply to message #524088] Wed, 21 September 2011 14:37 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
You are right Littlefoot. The distinct records in this column are as follows
SQL> select distinct receipt_detail_month
  2  from
  3  tbl_receipt_detail;

RECEIPT_D
---------
April
August
December
February
January
July
June
March
May
November
October

RECEIPT_D
---------
September
Term 1
Term 2


15 rows selected.

What needs to be done.

Thank You
Re: SQL [message #524107 is a reply to message #524093] Wed, 21 September 2011 15:13 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Term 1 and Term 2 are not valid Months, at least in english they are not.
Re: SQL [message #524131 is a reply to message #524107] Thu, 22 September 2011 00:13 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Obviously, all records that contain "Term 1" and "Term 2" have to be fixed. Or, alternatively, omit them (using the WHERE clause):
... WHERE receipt_detail_month not in ('Term 1', 'Term 2')
Re: SQL [message #524282 is a reply to message #524131] Thu, 22 September 2011 11:00 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
Thanks to all , yes its been sorted out by omitting Term1 and Term2 using where clause.

Another requirement is How do I achieve this.

I have a LOV attached to a text item (purpose_name) called (Lov_purpose). There is one more text item before (purpose_name)called (category_amount)which stores donation amount.
The requirement is such that if user enters amount Less than 100.00 then the column "water pump" (which is one column among other 70 available in the LOV) should not be visible in the LOV called (Lov_campaign)and remaining 70 must be visible.

How do I achieve this.
Re: SQL [message #524302 is a reply to message #524282] Thu, 22 September 2011 16:13 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
You've got an LOV with 70 columns? Don't you mean rows?
Re: SQL [message #524362 is a reply to message #524302] Fri, 23 September 2011 04:54 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
Yes my mistake, 71 rows in all in (LOV_Purpose)
Re: SQL [message #524363 is a reply to message #524362] Fri, 23 September 2011 05:12 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Would something like this do the job?
select col1, col2, ...
from your_table
where upper(purpose_name) <> case when :block.category_amount < 100 then 'WATER PUMP'
                                  else 'a value that does not exist'
                             end
Re: SQL [message #524563 is a reply to message #524363] Sat, 24 September 2011 15:10 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
Thanks for the sample code Littlefoot.

I am thinking differently. Since the LOV (Lov_Purpose) is based on table named "tbl_purpose". Cant we set LOV property or Record Group Property by checking amount in the "category_amount" on (key-next-item or key-down) field if entered amount is less than 100.00 then the option "water Pump" shouldn't be visible to the user(s) in the LOV.

The description of Tbl_Purpose;
 Name                            Null?    Type
 ------------------------------- -------- ----
 PURPOSE_CODE                             NUMBER(5)
 PURPOSE_NAME                             VARCHAR2(45)

and water pump is tagged with purpose_code = 23 in the table
Could you please suggest.
Re: SQL [message #524632 is a reply to message #524563] Sun, 25 September 2011 14:03 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
I am thinking differently

OK. So what code do you have on mind?
Setting LOV property [message #524784 is a reply to message #523310] Mon, 26 September 2011 14:32 Go to previous messageGo to next message
Hometown
Messages: 35
Registered: October 2010
Location: India
Member
Can we have two LOV's one with Water Pump and one without it and later swap them depending upon the amount entered in Category_amount.

for eg:
if :tbl_category_detail.category_amount < 100 then
set_item_property (:block.item_name,show_lov,lov_2)


LOV_2 would be one without water pump
I don't know whether set_item_property allows this.

Please help

Regards
Hometown
Re: Setting LOV property [message #524809 is a reply to message #524784] Tue, 27 September 2011 00:06 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes, you can switch from one LOV to another.

All built-ins are very well described in Forms Online Help System - I suggest you learn how to use it.
Previous Topic: When Session Timeout, clients receive Error FRM-93652: The runtime process has terminated abnormally
Next Topic: Problem in Inserting a Record
Goto Forum:
  


Current Time: Sat Sep 07 13:06:02 CDT 2024