Cancel Update If Record has been reported [message #483270] |
Fri, 19 November 2010 10:24 |
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 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
Kevin58 wrote on Fri, 19 November 2010 11:24But 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 |
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 |
cookiemonster
Messages: 13963 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 #483597 is a reply to message #483294] |
Tue, 23 November 2010 06:32 |
Kevin58
Messages: 79 Registered: January 2009
|
Member |
|
|
cookiemonster wrote on Fri, 19 November 2010 14:50You 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!
[Updated on: Tue, 23 November 2010 06:33] Report message to a moderator
|
|
|