How to Get a Choice Form Owner?

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Sep 16, 2011
Company: individual

Once there was a task to make a hidden warehouse in Warehouses catalog. This warehouse should not be allowed to be chosen in any field using the choice form.
I've solved this problem by adding a "hidden" attribute and a filter in the choice form of Warehouses catalog. That is fast and beautiful.
Now here is the question: how can I allow this object to be chosen for some parent forms?
I need to enhance the filter in the choice form to bypass that hidden warehouse if the choice form is opened from forms of some reports. Making additional choice form and setting it as choice forms for specific fields takes too much efforts. So I would like to define in the Script of the choice form which form is the owner and use it in the warehouses list filter.

 
#2
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Dec 6, 2011
Company:

I think it would be better to use ChoiceParameters property of the field to filter the choice form.

 
#3
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Sep 16, 2011
Company: individual

Thank you for reply, Evgeny!
There is a following problem with setting choice parameters as with using different forms: I have to specify those parameters for each field where it should be chosen. While I would like to define it once in the Script of a single choice form due to I know which reports I want to be unfiltered. Plus I can not set those parameters for autogenerated fields.

 
#4
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Dec 6, 2011
Company:

You can use FormOwner property of the choice form. It will contails the field of source form. Use it's Parent property (probably recursively) to get the source form.

 
#5
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Sep 16, 2011
Company: individual

Wow! That did the trick! Thank you, Evgeny!

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.