Home » Developer & Programmer » Forms » how to keep a value in the forms for 1 week
how to keep a value in the forms for 1 week [message #415411] Mon, 27 July 2009 10:31 Go to next message
zoey
Messages: 9
Registered: May 2005
Junior Member
Hi, Have a form when it is invoked by pressing a button it displays all the documents assigned to the current user. if the user assigns the document to a different dept (for example SALES) then the values of "SALES" should be displayed on the form for 1 week since it was changed to "SALES", and the user should be able to see it each time he opens the form. that field should be also grayed out for 1 week .
after 1 week that value "SALES" shouldn't longer display on the from. Please help I have been stuck with this problem for weeks now...please show me how to keep a field's value in my form for 1 week since the date it was changed.
Re: how to keep a value in the forms for 1 week [message #415429 is a reply to message #415411] Mon, 27 July 2009 15:07 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Alter table (which contains data you are talking about) and add another DATE datatype column which will contain date (and time) equal to the moment when the assignment was made.

Create a WHERE clause for the block and make it display records which have this "assign_date >= SYSDATE - 7 or assign_date IS NULL".

In order to "gray out" (i.e. disable item), use SET_ITEM_INSTANCE_PROPERTY which would make this item disabled if the above condition is met.

Re: how to keep a value in the forms for 1 week [message #415630 is a reply to message #415429] Tue, 28 July 2009 08:01 Go to previous messageGo to next message
zoey
Messages: 9
Registered: May 2005
Junior Member
Hi, changing the table is not an option. I have come up with the following script:

Declare
v_def_where varchar2(2000);
Begin

v_def_where := 'assigned_to = ''SALES'' and Sent_date > sysdate-7';

set_block_property('DOCS', default_where, v_def_where);
set_item_instance_property('docs.assigned_to' , to_number (:system.trigger_record), Enabled, property_false);

GO_BLOCK('DOCS');
EXECUTE-QUERY;
End


If this is correct. I don't know where I should put itin the block level or form level?
Please let me know...thanks in advance
Re: how to keep a value in the forms for 1 week [message #415639 is a reply to message #415411] Tue, 28 July 2009 08:38 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you've already got a date column you can use then you don't need to change the table.

Just add your where clause to the block where clause in the property pallete - you're always going to want to do that check so there's no point coding it seperately.

The set_item_instance_property call should go in the post-query trigger.
Re: how to keep a value in the forms for 1 week [message #415707 is a reply to message #415639] Tue, 28 July 2009 20:14 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Just remember to have an NVL to handle the situation when it has not yet been sent.

David
Previous Topic: Insert data in one transaction.
Next Topic: Calling PL/SQL Table in a package from a remote DB from form
Goto Forum:
  


Current Time: Fri Sep 20 09:32:13 CDT 2024