What is the differences between Object module and manager module

For students who study 1C Junior course.

#1
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 22, 2021
Company: 1C Vietnam

Hi everyone,
I'm getting confused with the two modules which is object module and manager module. And which kind of procedures we can write in object module and what about the other.

 
#2
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

So, the "Object Module" is designed to handle standard events. For example, an event to enter a catalog item, an event to write an item, delete, post a document and etc.

Basically, the write event also exists in the form module. But the write event in the form module occurs during interactive recording when working with a specific form.

The event "Write" in the object module will be executed on any write from any form of the given object. In addition, if the object is written programmatically, then the event of the object's module is triggered.

In the "Object module" you can embed all the checks for the correctness of the recorded data since, at the moment of recording the object, this procedure will be performed absolutely for any record.

In the "Object module" you can place a section for describing variables, describe arbitrary functions that may or may not be associated with an event, as well as a section of the main program.

In the main program section, you can, for example, initialize the local variables of this module. This program code will be executed when accessing this "Object module".

It should be noted that all procedures of the Object Module are compiled on the Server. Accordingly, the compilation directives ("&AtServer") don't need to be specified for the procedures and functions of the Object Module.

In Object Modules, you can describe methods that can be exported, and these methods will be available from outside.

Those. in addition to using the fixed methods of the object class, you can create additional methods for the object in the Object Module. This module should describe the corresponding procedure with the Export keyword.

Then it will be possible to refer to this procedure from outside. Moreover, this method will be displayed in the context tooltip. New methods in the context tooltip are highlighted in blue (blue p() for procedures and f() for functions). Pls see screenshot 1.

Similarly, you can create a new property by declaring a variable with the Export keyword. This property can also be accessed from outside. (scr. 2)

Thus, it's possible to expand the functionality of objects (to redefine new methods and new properties). However, the properties are dynamic and are not stored in the database.

If you need to use a property for an object that will be stored in the database, you must create an object attribute.

Download 1.png (19.13 KB)
Download 2.png (17.23 KB)
 
#3
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

In the "Manager module" you can override some of the standard events. For example, in "ChoiceDataGetProcessing", when you select an item (or items) from the list, you can do some additional filtering or checking (scr. 1).

In addition, in the "Manager module" you can create additional methods and indicate that they are export. In this case, it is possible to access these methods from the outside (scr. 2).

The difference between the export methods of the "Manager Module" and "Object Module" is that in order to call the "Object Module" method, you first need to get the object itself (that is, somehow get a reference and then convert this reference into an object).

After that, the export variables and methods of the "Object Module" will be available. For the "Manager Module", the call is simpler, for example:

Catalogs.Customers.MethodName

These are two different calls. Conversion from a reference to an object (the "GetObject" method) is a rather serious action for the system, since when an object is received, absolutely all data of this object is read, which can be quite lengthy.


The second difference is that "ObjectModule" is called for a specific element. Accordingly, we can assume that it's applicable for a specific element (for example, for a specific, previously selected product).

As for the "Manager module", it describes some general action for a group or for all elements of a catalog or some document.

For example, if you want to print a catalog item, you can use the Object Module.

But in the "Manager module" it's possible to make a more universal mechanism that will print, including a group of elements.

In addition, accessing the "Object Module" is still a longer action, since when accessing the "Object Module" all attributes of the object are read each time.

Therefore, it's more preferable to solve this problem (printing) in the "Manager's module".

Download 1.png (27.61 KB)
Download 2.png (19.23 KB)
 
#4
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 22, 2021
Company: 1C Vietnam

Thank a lot. Actually it is quite long to ready. Can they be summarise into some key points.

 
#5
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

OK :-)

The "Object module" refers to a specific object, such as a specific document or product, and the "Manager module" refers to a generalized object or list of objects. The procedure located in the "Manager module" can be called for a newly created and not yet written object.

 
#6
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 22, 2021
Company: 1C Vietnam

Yeah, it is what I expected. Thanh a lot for this easy explanation

 
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.