Answer the question
In order to leave comments, you need to log in
1C, how to make a global variable of a COM object?
I work with a 1C Catfish object, there is a problem with the namespace, this object exists only within the framework of the function in which it was created. I can’t attach it to props, 1C swears, I can put it in a global variable, but 1C refuses to work with it. I do not understand what the problem is, because of this the functionality is very limited.
Answer the question
In order to leave comments, you need to log in
If you want to reuse COM between server calls, you can try a shared module with repeated return values. Then if the user session has not migrated to another rphost and 20 minutes have not passed between calls, then the com connection will be established only once. On the client it is easier - you can write at the beginning of the form module
&НаКлиенте
Перем МояПеременная
We use Session parameters, we store the address to temporary storage in it.
When creating a COM connection, we save it in temporary storage and the address in the session parameter.
If necessary, we get the connection from the storage by address
Swears when you try to receive a global <server> variable on the client?
1) If working with COM takes place in one module (form module, processing object module, etc.), then declare a new variable before the procedures in the variables section, and then initiate it with an opened connection and use it while the object associated with the module is in memory.
2) If one connection needs to be "driven" (as an option) between different processing, which (we will further complicate) are launched from a background process, then it can be passed using method parameters.
*) Here in the comments they wrote about the ability to place in temporary storage. Maybe it's possible - I've never tried it. But keep in mind that values placed in temporary storage without specifying a unique identifier have a lifetime only until the first server call, and then the value is deleted, and if you specify a unique identifier, then only the identifier of an existing form can be specified and the lifetime is limited to the lifetime of the form (already it's easier to make an export variable on the form).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question