Home » Developer & Programmer » Forms » Cancel Update If Record has been reported (Forms 10g ver 10.1.2.3.0)
Cancel Update If Record has been reported [message #483270] Fri, 19 November 2010 10:24 Go to next message
Kevin58
Messages: 79
Registered: January 2009
Member
I have a situation where I don't want the users to be able to update a record where the date reported field has a date.

I have used the set_block_property(blk_id, update_allowed, property_false). But it still prompts me if I do change something and I try to exit the form.

How can I stop the "Do you want to save changes you have made" box from showing?
Re: Cancel Update If Record has been reported [message #483286 is a reply to message #483270] Fri, 19 November 2010 13:11 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Kevin58 wrote on Fri, 19 November 2010 11:24
But it still prompts me if I do change something and I try to exit the form.


If the block is set to no update allowed, how are you able to change anything?
Where did you put that code?
Re: Cancel Update If Record has been reported [message #483289 is a reply to message #483270] Fri, 19 November 2010 13:17 Go to previous messageGo to next message
Kevin58
Messages: 79
Registered: January 2009
Member
I think I see my error. I am setting the block property
at the form level key-commit trigger.

I think this should be a post-query trigger at the block level.

That way as the user navigates from 1 record to another the record should be locked or not depending if the report date is there.

What do you think? Is that the correct approach?
Thanks,

Kevin
Re: Cancel Update If Record has been reported [message #483294 is a reply to message #483289] Fri, 19 November 2010 14:50 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You do want post-query but not set_block_property - as it sets at the block level and not record, you'll end up with all the records being updatable or not depending on what the report date in the last record queried is.

You need to use set_item_instance_property to set update_allowed for each individual item in the record.
Re: Cancel Update If Record has been reported [message #483596 is a reply to message #483270] Tue, 23 November 2010 05:39 Go to previous messageGo to next message
cvs_1984
Messages: 136
Registered: August 2007
Location: Punjab, INDIA
Senior Member

Try it through

Pre-record and When Mouse Click.


Regards,

C V S
Re: Cancel Update If Record has been reported [message #483597 is a reply to message #483294] Tue, 23 November 2010 06:32 Go to previous message
Kevin58
Messages: 79
Registered: January 2009
Member
cookiemonster wrote on Fri, 19 November 2010 14:50
You do want post-query but not set_block_property - as it sets at the block level and not record, you'll end up with all the records being updatable or not depending on what the report date in the last record queried is.

You need to use set_item_instance_property to set update_allowed for each individual item in the record.


Thanks CM. I got this to work using your suggestion.

I ended up with creating two procedures sample_enable and sample_disable. One or the other is being called depending on the status of the date_reported field.

And the test is being done using the post-query trigger of the block.

Thanks again! Smile

[Updated on: Tue, 23 November 2010 06:33]

Report message to a moderator

Previous Topic: How to Save a file (Pdf, Image) to the database from form 6i
Next Topic: how to validate list item
Goto Forum:
  


Current Time: Thu Sep 19 14:00:32 CDT 2024