One way to transfer data from one 1C configuration to another is a software connection using COM. Many companies use several different databases, between which there must be certain connections and dependencies. If it is necessary not only to transfer data, but also to perform certain data processing, then a COM connection will be the optimal mechanism. The ability to analyze data from another 1C database is useful to any developer.

We connect via COM to the 1C database

To implement a COM connection in 1C, a special mechanism called COMConnector is used. This object is installed along with the platform and is used to connect infobases. It should be noted that for versions 8.2 and 8.3 objects with different names are used - “V82.COMConnector” and “V83.COMConnector”, respectively.

Remember that the duration of the COM connection to the database costs a license - do not get carried away with simultaneous execution of several connections. This is especially important for organizations that have a limited number of licenses. This issue can be resolved with the help of routine tasks that are executed when there are no active user connections to the information base.

To be able to connect to another database and request necessary information you should know the following information:

  1. What type is it - file or client-server;
  2. Where is it located;
  3. What name and password can you use to log in?
  4. What data are you interested in?

From the first three points, to implement a COM connection, you need to create a string of parameters. Depending on the type of information security, it will differ appearance. Using the received string, a connection is made, with the help of which you can collect data from another database for analysis and processing using any methods.

Connection ParametersFileIB = "File=""Path_to_database""; Usr=""User_name"";Pwd=""Password"""; Connection ParametersClientServerIB = "Srvr=""Server_Name""; Ref=""Database_Name""; Usr=""User_Name""; Pwd=""Password""";

The connection function is simple and should not raise any questions if all parameters are specified correctly. To speed up debugging and analysis possible errors it is better to enclose the connection in the “Try” construction. The function will return a value of the “COM object” type, with which you will work to obtain the necessary data.

&OnServer Function ConnectToBase() exportConnectionIB Parameters = "File=""E:\1c database\ERP""; Usr=""Administrator"";Pwd=""1"""; V83COMCon= New COMObject("V83.COMConnector"); Attempt Return V83COMCon.Connect(IB Connection Parameters); Exception Report(ErrorDescription()); Return Undefined; EndAttempt; EndFunction

Through a COM connection you can not only select data, but also add it to the database you are connecting to. Remember that we can transfer 4 primitive data types via a COM object. Other types will have to be specified using the platform's built-in search functions. Please note that global platform functions are also called via a COM connection.

We receive data from the 1C database

After you have received the desired object, you need to read data from another database. To do this, we use a request via a COM connection in 1C 8.3 using the received value of the “COM object” type from the function. It is important to first connect to the database and then execute the request. Execution occurs through the NewObject method, specifying the object type in string form as a parameter - “Request”.

&OnServer Procedure TestCOMOnServer() Connection = ConnectToBase(); If TypeValue(Connection) Type("Undefined") Then RequestBPZO = Connection.NewObject("Request"); RequestBPZO.Text = "SELECT first 15 | DirectoryUser.Name AS Name |FROM | Directory.users AS DirectoryUser"; Select = RequestBPZO.Execute().select(); While Selection.next() loop Report(Selection.Number); EndCycle; endIf; End of Procedure >

For example, to obtain information about users of a certain department, we will set a condition in the request through parameters. One parameter will be simple type– a string, and the division – a link to the directory element “Enterprise Structure”. The result of the query is a table with the listed fields of the type that they exist in the database to which the COM connection occurred. If you need to convert them to other types, use standard features platforms:

  • Line();
  • Number();
  • Date of().
RequestBPZO = Connection.NewObject("Request"); RequestBPZO.Text = "SELECT first 15 | DirectoryUser.Name AS Name | FROM | Directory.Users AS DirectoryUser I WHERE | DirectoryUser.Department = &RequiredDepartment | And DirectoryUser.Name like ""%"" + &RequiredName+ ""%""" ; Request BPZO.SetParameter("Required Department", Connection. Directories. Enterprise Structure. Find By Code("00-000023")); RequestBPZO.SetParameter("RequiredName","Ekaterina"); Select = RequestBPZO.Execute().select(); While Selection.next() loop Report(Selection.Name); EndCycle;

If you need to transfer an array to the database for selection based on several parameters, for example, departments, the NewObject command is also used. Similarly, you can pass a list or table of values, filling them with elements of another database through a connection. All are available for you to search existing methods platform objects and mechanisms.

RequestBPZO = Connection.NewObject.("Request"); RequestBPZO.Text = "SELECT first 15 | DirectoryUser.Name AS Name | FROM | Directory.Users AS DirectoryUser I WHERE | DirectoryUser.Department B (&NecessaryDepartment) | And DirectoryUser.Name like ""%"" + &NecessaryName+ ""%" ""; Array of Departments = Connection.NewObject("Array"); Array of Departments.Add(Connection.Directories.Enterprise Structure.Find By Code("00-000023")); Array of Departments.Add(Connection.Directories.Enterprise Structure.Find By Code("00-000038")); Array of Departments.Add(Connection.Directories.Enterprise Structure.Find By Code("00-000046")); Request BPZO.SetParameter("Required Department", Array of Departments); RequestBPZO.SetParameter("RequiredName","Ekaterina"); Select = RequestBPZO.Execute().select(); While Selection.next() loop Report(Selection.Name); EndCycle;

When transferring documents or directory elements, the question of controlling the transfer of a specific object always arises. With the help of COM connections, such problems can be solved through a unique identifier. You need to find an object in the plug-in database by identifier from the current information security using the “GetLink” function, using the identifier as a string. If one is not found, you can create it using a COM connection.

StrIdent = String(Directories.Users.FindByCode("00-0000313").UniqueIdentifier()); If NOT ValueFilled(Connection.Directories.Users.GetLink(Connection.NewObject("UniqueIdentifier", StrIdent))) then NewUser = Connection.Directories.Users.CreateItem(); NewUser.Name = Directories.Users.FindByCode("00-0000313").Name; NewUser.Individual = Directories.Users.FindByCode("00-0000313").Individual; NewUser.Write(); endIf;

Also, the COM connection has the right to use procedures and functions from common modules 1C with the “External connection” property enabled. In addition to this condition, the called function or procedure must be export and not include interactive actions performed on the server. Otherwise, you will see an error about the operation being invalid.

Compound..; VariableFunction = Connection..; function call>general module name>procedure call>general module name>

The possibilities for external connection with another database in 1C are quite extensive and can allow you to perform many tasks. It is important to be able to correctly evaluate the tools and choose optimal solution. In most cases, this skill appears only with experience or by studying examples of the work of experienced specialists.

Print (Ctrl+P)

One of the options for exchanging data between 1C databases is exchange via a COM connection. Using a COM connection, you can connect from one 1C database to another and read or write data. This method can be used both in client-server versions of databases and in file databases. This article discusses these types of connections on platform 8.3

com connection

You can create two types of COM objects for the 1C application. This is ole connections V83.Application and com connections V83.COMConnector . In case of V83.Application An almost full-fledged copy of the 1C application is launched. In case of use V83.COMConnector a small one is launched server part. The speed of operation in this case is higher, but some functions may not be available. In particular, working with forms and common modules for which the property of working with external connections is not set. Mostly you should use V83.COMConnector and only in case of lack of functionality V83.Application. The difference in operating speed can be especially noticeable on large-volume databases. For platform 8.2 used V82.Application or V82.COMConnector

Establish an OLE connection

Connection = New COMObject(“V83.Application” ) ;

Establish a COM connection

Connection = New COMObject(“V83.COMConnector” ) ;

Connection string

//For the client-server option
Connection String= “Srvr = ““ServerName” “;Ref = “ “BaseName” ;
//For file mode option:
Connection String= “File = ““PathKBase” “; Usr = UserName; Pwd = Password”;
Attempt
Connection = Connection . Connect(ConnectionString) ;
Exception
Message = New MessageToUser;
Message . Text = “Failed to connect to the database” + DescriptionErrors(); Message . To report();
EndAttempt ;

Disconnection

Connection = Undefined ;
For object V83.Application It is necessary to terminate the connection, otherwise an incomplete session will remain, which will then have to be deleted manually. In case of V83.COMConnector the connection is broken automatically when the procedure in which the connection was made is completed. And there is one more small point. For the user under whom the connection is being made, the “Request confirmation when closing the program” checkbox must be disabled in its settings.

NewObject() method

To create a new object, you can use the NewObject() method, for example:

For V83.COMConnector

RequestCOM = Connection. NewObject( "Request ") ;
TableCOM = Connection. NewObject( “Table of Values”) ;
ArrayCOM = Connection. NewObject(“Array” ) ;

ViewCOM =Connection.NewObject

For V83.Application

RequestOLE = Connection. NewObject(“ Request ") ;
TableOLE = Connection. NewObject(“Table of Values”) ;
ArrayOLE = Connection.NewObject(“Array” ) ;
ViewCOM =Connection.NewObject(“UniqueIdentifier”, StringUID);

RequestCOM . Text ="CHOOSE
| Positions of Organizations. Code,
| Positions of Organizations.Name
|FROM | Directory.Positions of Organizations
HOW TO POSITIONS OF ORGANIZATIONS”;

Result = RequestCOM. Run();
Sample = Result. Choose () ;
Bye Selection. Next()Cycle
EndCycle ;
You can also use configuration object managers:
DirectoryCOM = Connection. Directories. DirectoryName;
DocumentCOM = Connection. Documentation. DocumentName;
RegisterCOM = Connection. Information Registers. RegisterName ;

Receiving and comparing enumeration via COM connection

To compare the values ​​of enumeration elements defined in the configuration, it is necessary to convert these elements to one of the primitive types, the comparison of which is easy. Such types can be either a numeric type or a string type. You can convert the value of an enumeration element to a numeric type like this:

Enum Item = Connection.Directories.Directory1.FindByCode(1).Props1;

PossibleValues ​​= Enum Element.Metadata().Enum Values;

EnumerationElementNumber = PossibleValues.Index(PossibleValues.Find(Connection.XMLString(EnumerationElement)));

If EnumerationItemNumber = 0 Then Report( “Enumer value1”);

ElseIfEnumerationItemNumber = 1 Then Report("EnumerationValue2");

endIf;

Retrieving an object via COM by identifier

Through configuration object managers we obtain a com object, for example:
DocumentCOM = Connection. Documentation. DocumentName;

Then we get a unique identifier string:

StringUID =Connection.string ( DocumentCOM.UniqueIdentifier())

Identifier = New U uniqueIdentifier(StringUID);
WITH linkByIdentifier = Documents[DocumentName].GetLink(Identifier);

If you need to find a com object by document by identifier, then you need to write like this:

WidCOM = Connection.NewObject(“UniqueIdentifier”, StringUID);
LinkByIdentifier = Connection.Documents[DocumentName].GetLink(WidCOM);


Keywords: COM, connection, external, OLE, Automation, Connect, ComConnector, Srvr

When using 1C:Enterprise 8.0 COM connections to access data, there are the following advantages compared to using an Automation server:

  1. More quick installation connections, since there is no need to create a separate process operating system, and all actions are performed within the calling process;

  2. Faster access to the properties and methods of 1C:Enterprise objects, since organizing an access does not require interprocess communication;
  3. Less consumption of operating system resources.

In general, working with 1C:Enterprise 8.0 via a COM connection is similar to working with 1C:Enterprise in server Automation mode. The main differences are as follows:

  1. In the case of an Automation server, a full-fledged 1C:Enterprise 8.0 application is launched, and in the case of a COM connection, a relatively small in-process COM server is launched.

  2. Not available when working via COM connection functionality somehow related to the organization of the 1C:Enterprise 8.0 user interface;
  3. When operating a COM connection, the 1C:Enterprise 8.0 configuration application module is not used. Its role when working with a COM connection is played by the external connection module.

1.1 Procedure for establishing a COM connection

To organize access to 1C:Enterprise 8.0 data via a COM connection, the following sequence of actions is performed:

  1. a COM object is created with the identifier V8.COMConnector, with the help of which the connection is established;

  2. the Connect method of the previously created V8.COMConnector object is called. The Connect method returns a link to a COM connection object with the 1C:Enterprise 8.0 infobase;
  3. through the received COM connection object, valid methods, properties and objects are accessed information base with which the connection has been established.

Important! Due to the lack of a user interface in a COM connection, not all objects, properties and methods can be used in a COM connection.

1C:Enterprise objects accessible externally via a COM connection:

  1. Exported variables and procedures/functions of the external join module

  2. Exported variables and procedures/functions of common modules
  3. Including and excluding entire modules by setting properties of common modules

  4. Including and excluding fragments of common modules using a preprocessor
  5. Global context 1C:Enterprise 8.0, with the exception of objects tightly linked to the client application (TextDocument, TabularDocument, ...)

1.2 External connection module

As already noted, the responsibilities of the application module when working through a COM connection are performed by the external connection module. This module may have event handler procedures When SystemStarts() and WhenSystemCompletes(), which can contain actions performed upon initialization and termination of the connection, respectively.

Procedures, functions and global variables defined in the outer join module keyword Exports become, as in the case of an application module, part of the global context.

1.3 Common modules

The properties "Client", "Server" and "External Connection" have been introduced for common modules. They are intended to determine in the configuration the use of modules in the client - server version and in COM connection mode.

1.4 Object "V8.COMConnector"

The only task solved by the V8.COMConnector COM object is establishing a COM connection with the 1C:Enterprise 8.0 information base. An unlimited number of connections can be established using one instance of the V8.COMConnector object. The V8.COMConnector object has a single Connect method, designed to establish a COM connection with the 1C:Enterprise 8.0 infobase.

<СтрокаСоединенияИБ>

The connection line with the information security system is a chain of fragments of the form Parameter=Value. Fragments are separated from each other by ";". If the value contains whitespace, it must be enclosed in double quotes (").

Common parameters:

Usr - username;
Pwd - password.

The following parameter is defined for the file version:

File - infobase directory.

The following parameters are defined for the client-server option:

Srvr - 1C:Enterprise server name;
Ref - name of the infobase on the server.

The Connect method establishes a COM connection to the 1C:Enterprise 8.0 infobase and returns a link to the COM connection object.

// A connector object is created
V8 = New COMObject("V8.COMConnector");
// a COM connection object is created
Connection = V8.Connect("File=""c:\InfoBases\Trade""; Usr=""Director"";")

1.5 COM connection object

COM connection to the 1C:Enterprise information base is provided by full access to its global context (see “Execution context of a program module”). Therefore, a COM connection can have as its methods: system constants, values ​​specified in the configurator of objects that are accessed using managers (for example, constants, enumerations, directories, documents, document logs, reports, processing, plans for types of characteristics, plans accounts, plans of calculation types, registers), as well as variables declared in the external connection module with the Export keyword.

In addition, the COM connection has an additional NewObject method that can be used to create values ​​of certain types.

tk = Connection. NewObject("ValueTable");

String method Allows you to obtain string representations of 1C:Enterprise values.

View = Connection.String(Data.UniqueIdentifier());

1.6. Features of working with a COM connection

In Automation and in a COM connection, TRUE and FALSE have the following values: -1 (minus one) and 0.

It is possible to organize a pool of COM connections. At the same time, several COM connection objects are created IN ADVANCE on the receiving server 1C:Enterprise and it takes even less time to establish a connection, since there is no need to create new object.

A new Query Builder object has been implemented, designed to generate query texts based on the specified settings. This object supports report builder functionality that is not related to report output to a spreadsheet document and other user interface tasks. This object can be used on the 1C:Enterprise server and in a COM connection.

You can use COM objects when running the built-in language on the 1C:Enterprise server.

COM errors are converted to embedded language exceptions.

If the configuration attempts to create an invalid object, such as a spreadsheet document, in an external join module, in a common module, or in an object module, the COM connection may not be established or may be terminated as an exception.

Question: Parsing a site using COM IE 11


Good day.!
The question is painfully well known, you need to take the information from the site. But there are nuances:
1. It is not possible to go directly to the authorization page (first go to home page, click the LogIn link, get an authorization form and only then log in).
2. You need to visit the website via search bar search for data, then read it and search again (the data can be in Russian and English, i.e. if the data for search is in Russian, then you need to search in the “Russian version” of the site, and this is another link to another page. It’s the same issue with English).

Eventually:
- go to the home page - log in - look for data - (go to another version of the site, if necessary) - take it.

Problem:
Data is not read into the "document" property when following a link.
It occurs at two points:
- when we follow the link to log in (this is not a button, but just a link);
- when we change the language on the site (also a link).

Note
If, before following a link at the authorization stage, you receive a link, close the com and open it again with the transition through the IE.navigate("link") method, then the data in the "document" property goes normally. But you won’t be able to do the same thing when changing the language on the site, because... I need to log in again and plus I wouldn’t want to solve this problem exactly like that.

Here's the code:

&On the Client Procedure SetWaitingIE(IE, SecondCall=False) If NOT IE.Busy Then D = CurrentDate() + 3; While D >= CurrentDate() Loop If IE.Busy Then Abort; endIf; EndCycle; endIf; While IE.Busy Loop EndLoop; While IE.ReadyState< 4 Цикл КонецЦикла; Попытка Если IE.Document.ReadyState = Null Тогда IE.Refresh(); УстановитьОжиданиеИЕ(IE); КонецЕсли; Пока IE.Document.ReadyState <>"complete" Cycle EndCycle; Exception If SecondCall Then Return; Else Link = IE.LocationURL; IE.Quit(); IE = GetCOM("InternetExplorer.Application"); IE.Navigate(Link); SetExpectIE(IE, True); endIf; EndAttempt; EndProcedure &OnClient Function PerformUserAuthorization(IE, Link, Login, Password, Authorized=False, SC=0) Attempt Elements = IE.Document.GetElementsByName("username"); If Elements.Length = 1 Then For Each El Of Elements Loop El.Value = Login; EndCycle; endIf; Elements = IE.Document.GetElementsByName("password"); If Elements.Length = 1 Then For Each El Of Elements Loop El.Value = Password; EndCycle; endIf; IE.Document.GetElementById("ID").Click(); SetWaitingIE(IE); Authorized = True; Exception If CN > 3 Then Return False; endIf; IE.Quit(); IE.Navigate(Link); SetWaitingIE(IE); MF = MF + 1; If PerformUserAuthorization(IE, Link, Login, Password, SCH) Then Return True; endIf; EndAttempt; Return Authorized; EndFunction &OnClient Procedure Upload(Command) SpTables = GetListTablesForUpload(); If SpTables = False Then Return; endIf; IE = GetCOM("InternetExplorer.Application"); For Each Row From SpTable.SOURCE_LIST Cycle RA = Row.ID; Resource = String.RESOURCE; IE.Navigate(Resource); SetWaitingIE(IE); Try If Line.NEW_PAGE_IN_LOGIN = 1 Then Classes = IE.Document.GetElementsByClassName("ClassName"); If Classes.Length = 1 Then For Each Class From Classes Loop Resource = Class.All(0).Href; Abort; EndCycle; Trying IE.Quit(); IE = IE.Navigate(Resource); SetWaitingIE(IE); Exception Report("Connection to the site "" +String.NAME + "" failed!"); Abort; EndAttempt; Otherwise Report("Connection to the site "" +String.NAME + "" failed!"); Abort; endIf; endIf; If NOT PerformUserAuthorization(IE, Resource, String.LOGIN, String.PASSWORD) Then Report("User authorization on the site "" + String.NAME + "" has not been completed!"); Abort; endIf; Resource = IE.LocationURL; List of Persons = SpTable.FACE_CODES.FindRows(New Structure("SOURCE", RA)); ListNotFound = New Array; For Each Person From the List of Persons Cycle PersonName = Person.NAME_IN_SITE; This is Russian = CharacterCode(PersonName, 1) >= 1040; TechResource = ?(This is Russian, StrReplace(Resource, "en_US", "ru_RU"), StrReplace(Resource, "ru_RU", "en_US")); If TekResurs<>IE.LocationURL Then RootClasses = IE.Document.GetElementsByClassName("ClassName"); If RootClasses.Length = 1 Then For Each RootClass From RootClasses Loop Classes = RootClass.Children; Abort; EndCycle; AmGroup = False; RuGroup = False; For Each Class From Classes Loop If HPreg(Class.ClassName) = "dropdown-header" Then AmGroup = Find(Class.InnerText, "Americans") > 0; RuGroup = Find(Class.InnerText, "Europe") > 0; ElseIf HPreg(Class.ClassName)<>"selected" Then If AmGroup And Find(Class.All(0).InnerText, "English") > 0 OR RuGroup And Find(Class.All(0).InnerText, "Russia") > 0 Then IE.Navigate(Class .All(1).Href); SetWaitingIE(IE); Abort; endIf; endIf; EndCycle; endIf; endIf; IE.Document.GetElementById("ID").Value = PersonName; FindButton = IE.Document.GetElementById("ID"); FindButton.Focus(); FindButton.Click(); Trying to SetExpect(IE); //Circuit the received data ExceptionListNotFound.Add(Person); Continue; EndAttempt; EndCycle; Exception Report("Error:" + Symbols.PS + ErrorDescription()); Abort; EndAttempt; EndCycle; IE.Quit(); End of Procedure

Answer:

The topic is very interesting, but personally, unfortunately, I have neither the experience nor even the opportunity to somehow understand this problem. If you can find information on this topic, please share it.
--- An association messages, April 29, 2016 ---

As I understand it, access to SQl database No?

--- Message merging, April 29, 2016 ---

Well, if parsing, then what kind of access?

Question: COM connection 1C 8.3 - 1C 8.3 Is it possible to enter the debugger in the connection


I wanted to ask members of the forum if it’s possible to debug at all when I connect via a COM connection using processing from one database on platform 8.3.6 (BP 3.0) to the external connection module of a self-written database (also running on platform 8.3.6) and call exports from it procedures using processing? The databases are currently file-based and are located on one PC, but a server version is planned. Until this time, I used the constructions below to transmit arbitrary code for execution over a COM connection, as well as to log errors. Here are fragments of procedures in the self-written database in the external connection module:

Function ExecuteIn(CodeExecute, Auxiliary Parameter = "") Export
Security check(); // Protection against execution attempt malicious code when connecting externally on behalf of another user Answer = "0" //If nothing needs to be returned, then if there are no errors in the code  //returns just OK  //Because The transmitted code may contain errors, then we will wrap its execution in an attempt. Try to Execute(CodeExecute); // Execute the code as a string on another computer via a COM Connection (Libra Base External Connection Module) Exception   //if there is an error, then return its text Response = ErrorDetailView(ErrorInfo()); EndAttempt ; Return Reply; EndFunction Function TestConnection(InParameter, OutParameter) ExportSecurityCheck(); // Protection against attempts to execute malicious code when connecting externally on behalf of another user. OutParameter = "There is a connection with the scale base via COM connection!"; Return True ; EndFunction
From BP 3.0 I execute the following fragment:
Attempt
Com = New COMObject("V83.COMConnector"); Connection = Com.Connect ("File=""C:\1 c\Base_1C\Libra""; Usr=""ComExchange""; Pwd=""1"";"); TellUser("Test passed! There is a connection to the scale database"); Exception Error = ErrorDetailView(ErrorInfo()); TellUser("There is no COM connection to the Libra base! Details"+Error); Com=Undefined ; Return ; EndAttempt ; Out = ""; In = "1"; If Connection.Communication Test(In, Out) Then TellUser("Communication test with scale configuration successful! Answer: "+Out); Otherwise TellUser("Communication test with the scale configuration failed! Answer: "+Out); EndIf ;
I understand, of course, that it will not be possible to enter the Execute(CodeString1C8) operator, but is there such a possibility when calling a remote module procedure external connection from the main database Connection.TestConnections(In, Out) to enter its code in the same debugger session in the Security Check() function of their calling procedure?
I already looked at the documentation that I could find on this issue. I set the options to enable debugging and breakpoints everywhere in both configurations. I launched both configurators.
Is it even possible in this situation to debug the Security Check() procedure further on the side of the external connection module?

Question: Wrong IP address in COM connection


There is processing that transfers documents via V83.ComConnector between servers. Server 1 (1C version 8.2.19.90) always connects to Server 2 (version 8.3.8.2033). The connection line contained the IP address of server 2 and everything worked well. On server 1 itself I also saw the installed platform as on server 2, version 8.3.9.2033 (if this is important).

The problem is that on Server 2 the IP address changed, processing of course stopped working, and when I entered a new IP in the connection line, processing generates an error, the description of which is still the old IP (!) and the text “An attempt to establish a connection was unsuccessful , because the required response was not received from another computer within the required time, or an already established connection was terminated due to an incorrect response from an already connected computer."

They rebooted everything, cleared caches, etc., the admins swear that everything is ok on their part, you can log in from one server to another via RDP, etc.

What could be wrong, how can I solve it? I looked all over the Internet and couldn’t find such a situation!

Answer:() 100% sure! The second day I try, as I wrote, I look at it with a debugger, I even created a stupid single-cell processing for a connection test, that error pops up and that’s it

Question: COM connection to different versions


Hi all.
I have a database ala “Consolidation”, which collects different data from different databases and brings everything into one pile. The problem is that you need to connect to these databases via com, but they different versions, accordingly, I end up catching an error like
Connection error!(ExternalProcessing.TransferHistory.Form.Form.Form(12)) : Error when calling the context method (Connect) : An exception occurred (V83.COMConnector. 1 ) : Mismatch between client and server versions 1 C:Enterprise Client versions differ and server (8.3. 8.1964 - 8.3. 6.2332), client application: COM connection

I set up one connection, another one falls off...

I know that somehow, through the component service, you can create “your own classes (connectors)” for each version and then create a New COM Object corresponding to the platform version of the class... maybe I’m wrong.

Help me overcome this problem...

Answer: That's it... I'll remove the question..

Question: Com Error in Processing Filling


Hello.
8.2 Retail 1.
I connect to 8.1 Not a typical conf.
I connect via com to the database and try to create a document, but when calling “CreateDocument()” or “GetObject()” an error occurs in the procedure ProcessingFilling. see fig.

I try the same thing in the 8.1 database itself, but there is no error, and I also don’t enter Filling Processing.
What could be wrong?

Answer: turboq, a crookedly written document module!

Added after 5 minutes
She is not called! She's trying to compile! But since when connecting via ComConnector the Dialog Mode issue does NOT EXIST, the document module cannot be compiled.
For such cases, when it is necessary to implement work with a dialog in an object module, use instructions to the preprocessor

This is not your mistake, but an error in the document module in the database you are connecting to.

In the database, the code is executed on the client and there is a Dialogue Mode, so everything happens without errors

Do not use ComConnector, V8.Application for connection, then interface things will be available to you

Added after 5 minutes
=======================================================================================================================
from the description of the external connection (SP) I highlighted in bold what you should read about ComConnections

Description:

In general, working with 1C:Enterprise 8 via an external connection is similar to working with 1C:Enterprise in server Automation mode. The main differences are as follows:

  • In the case of an Automation server, a full-fledged 1C:Enterprise 8 application is launched, and in the case of an external connection, a relatively small in-process COM server is launched.
  • When working through an external connection, functionality that is in one way or another related to the organization of the 1C:Enterprise 8 user interface is not available;
  • When working with an external connection, the managed application module (regular application module) of the 1C:Enterprise 8 configuration is not used. Its role when working with an external connection is played by the external connection module.
When using an external connection, there are the following advantages compared to using an Automation server:
  • Faster connection establishment, since there is no need to create a separate operating system process, and all actions are performed within the calling process;
  • Faster access to the properties and methods of 1C:Enterprise objects, since organizing an access does not require interprocess communication;
  • Less consumption of operating system resources.
To organize access to 1C:Enterprise 8 data via an external connection, the following sequence of actions is performed:
  • a COM connection manager is created, with the help of which the connection is established;
  • a call is made to the Connect method of the COM connection manager. The Connect method returns an external connection to the 1C:Enterprise 8 infobase;
  • through an external connection, access to valid methods, properties and objects of the infobase with which the connection is established is made.
Important! Due to the lack of a user interface, not all objects, properties and methods can be used in an outer connection.
An outer join provides full access to its global context. Therefore, an external connection as its methods can have: system constants, values ​​​​of objects specified in the configurator, access to which is carried out using managers (for example, constants, enumerations, directories, documents, document logs, reports, processing, plans of characteristics types, charts of accounts , calculation type plans, registers), as well as variables declared in the external connection module with the Export keyword.

Availability:

Integration.

Question: COM connection, characteristics type plan


The task is to programmatically create a new element in a known plan of characteristic types via a COM connection. The connection is established, everything is fine here.

I write like this:

TypeDescriptionTech = New TypeDescription("DirectoryLink. Counterparties"); PurposeProperties = Connection. Plans of Types of Characteristics. Purposes of Properties of Categories of Objects. FindByName(“Directory “Individuals””); NewElement = Connection. Plans of Types of Characteristics. Object Properties. CreateItem(); NewElement. Name = PropertyName; NewElement. PropertyAssignment = PropertyAssignment; NewElement. ValueType = DescriptionTypesTech;

The last line doesn't work. And this is understandable, it finds such a type for the database where 1C is running, but I need a type for the attached database. How to get it?

In my version, an element is simply created with the value type " Custom list" It works in principle, but is somehow ugly.

Platformform 8.3. A COM connection is a prerequisite. Solutions without its use are not of interest.

Answer:

Rolls. Thanks, it worked.

Question: COM connection. Query parameter problem


Good day.
Problem with request via COM connection.

Perem TK; Nomenclature Array = COM.NewObject("Array"); For Each Line from the TKNomenclature Cycle Nomenclature = COM.Directories.Nomenclature.GetLink(COM.NewObject("UniqueIdentifier", Abbr(String.Nomenclature.Identifier))); Nomenclature Array.Add(Nomenclature); EndCycle; If ArrayItems.Quantity()<>0 Then Request = COM.NewObject("Request"); Request.Text = "SELECT |PricesItemsSliceLast.Commodities AS Nomenclature, |PricesItemsSliceLast.SalePrice AS Price, |PricesItemsSliceLast.RateVAT, |PricesItemsSliceLast.RateNP |FROM |RegisterInformation.PricesSliceLast(|&DateDoc, |T ipPrices = &TypePrices |And Inventory Inventory B ( &Array of Nomenclature) |And Inventory and Materials.ThisGroup = FALSE |And Registrar LINK Document.Setting SalesPrices) AS NomenclaturePricesSliceLast"; Request.SetParameter("Item Array", Item Array); Request.SetParameter("DataDoc", EndDay(ParametersStructure.DataDoc)); Request.SetParameter("PriceType", COM.Directories.PriceTypes.GetRef(COM.NewObject("UniqueIdentifier", ParameterStructure.PriceType.Identifier))); TZ = COM.NewObject("Value Table"); TK = Request.Run().Upload(); Otherwise TK = New ValueTable; TK.Columns.Add("Nomenclature"); TK.Columns.Add("Price"); TK.Columns.Add("Percentage"); TK.Columns.Add("VAT rate"); endIf;

The problem is precisely with the item or an array of items; if you set them as a parameter, the request returns empty prices; if you do not specify this parameter at all, then the request returns the correct data.
In the same query console external base everything works without problems.
What could be wrong?

Answer:

Try doing it through VremTable. Create a table of values ​​with columns resp. like, fill it out, pull it into the request, and then apply it with an internal connection.

Question: Com connection from file database to file database


Good morning. Eat file database 8.3, from it I’m trying to connect to another file database using a com connection:

Directory = "C:\Users\1C\Workflow (test)"; User = "Administrator"; Password = ""; Connection Parameters = "File="+Directory+";Usr="+User+";Pwd="+Password+";"; V83 = New COMObject("V83.COMConnector"); Attempt Connection = V83.Connect(ConnectionParameters); Exception Report("Could not connect to document flow!"); EndAttempt;


An exception is thrown, without an error description.
Both databases are forced to launch in 8.3. The directory and user are specified correctly. What could be the reason?

Answer:

I write the line of code V82 = New COMObject(" V83.COMConnector"); and the rest of the code is as below, without changes.

When the versions of the source and destination platforms are different, an error occurs.

It’s not clear which version of the library to register and where to register it?

I think I need to register the library, version 8.2.18.61, and I do this via a bat file

regsvr32 /n /i:user "C:\Program Files (x86)\1cv82\8.2.18.61\bin\comcntr.dll"
pause

msk-test1c:1641 -- this is server 8.3.5.1098
V82 = New COMObject("V82. COMConnector"); Report ("Connect to Accounting 3.0..."); Attempt Connect = V82. Connect("srvr = ""msk- test1c:1641""; ref = ""db_test""; usr = ""Administrator""; pwd = ""123"""); Notify ("Hurray connection established!"); Exception Report("No connection to the database!"); Report(ErrorDescription()); // Info = InformationAboutError(); // Report("Description= "" + Info.Description + """); // Report ("ModuleName= "" + Info.ModuleName + """); // Report ("LineNumber=" + Info.LineNumber); // Report ("SourceLine= "" + Info.SourceString + """); Return; EndAttempt;

Where to register the library, on the client, on the 8.2 server, on the 8.3 server? Figure below.
(for the client-server version, and for the file version of the 1C database)

Answer: There was a task to communicate with one terminal through a web service. The base is, well, let's say light weight. Also 0.5 or faster?

It's hard to say - I don't have enough data. We were pleased with 0.5 seconds, minus the unnecessary 1C client on a third-party machine, minus synchronization of library versions after updating the 1C engine, minus the God-damned comsafearray, normal names and field types... He thought of us from the other side (a system that integrates with 1C) “they won’t understand” when it turns out that they need to rewrite their 1C calls to a new “system communication model”. But having tried one function once in the test database, now we are teased with “let’s switch to the service as soon as possible.”

Question: How to use TypeContains for Com objects?


If Attribute.Type.ContainsType(Type("DirectoryLink.Nomenclature")) Then There IsNomenclature = True; endIf;

"Props" was received from a com connection with another 1c database. An error occurs when comparing:

(ExternalProcessing.Coefficient Recalculation.Form.Form.Form(183)): Error when calling the context method (ContainsType)
If Attribute.Type.ContainsType(Type("DirectoryLink.Nomenclature")) Then
because of:
An exception occurred (1C:Enterprise 8.3.8.1964): Type mismatch (parameter number "1")

I suspect it should be compared with the type in com? How to check the type correctly?

Answer:

It doesn't roll. I solved the issue like this:
In the receiver database in the general module with the external connection checkbox checked, the code is:

Function CheckAttributeType(Attribute, Type) Export Return Attribute.Type.ContainsType(Type(Type)); EndFunction

In the database from which I connect, I call the procedure via Com:

ComConnection.Avis_ExchangeProcedures.CheckAttributeType(Attribute, "DirectoryLink.Nomenclature")

) That's right

At the same time, I have seen more than once when publications that did not even reach 10 points simply “took off.”
Why did this happen? Apparently because someone clearly liked them.


This is what I’m saying, that it would be nice to understand how much you need it without reading the rating article, or to evaluate it not so primitively +/-. As for what I liked, I would correct it this way: it gained so much due to the fact that the stars aligned and a lot of people gathered on the site and many liked it, you yourself understand this is a matter of chance because as soon as the article leaves home page then it can already be found only by request, and so everyone passing by votes. And, as far as I understand, constant comments = promotion of the article allow you to maintain it on the main page.
This is precisely why they put shops on public streets - after all, what is often important is not the quality and relevance of the goods, but the trafficability of the place; people walking often buy something that they will throw away the next day, just for the sake of the process. This is a disease that has long been known to everyone - shopping addiction. Or simply increasing the flow increases the likelihood of the right buyer.

And the pros and cons... - this is just a kind of “thank you” for the time and work spent


Those. Does a minus also count as a “thank you”? I wanted to know your opinion on whether it should be used in such cases, and how interesting others think? Should you put it when the article is harmful/bad or when it is simply useless/empty for you?
In my opinion, the article looks like a simple rating increase, because:
1. The problem with types I cited was completely ignored by the author, although he was not too lazy to write a bunch of comments.
2. There is an obvious inaccuracy in the article: it is said that this is the only way

V82 = New COMObject("V82.ComConnector"); Code = AccountCOM.Code;


but I can easily do it using processing like this:

Report(Base. Directories. Counterparties. Find By Name("LLC"). Code);


and everything is fine! And I choose the connection V82.ComConnector
It’s somehow strange that the author doesn’t care at all that his article contains the problems that were pointed out, but he doesn’t react in any way.
3. But there is still a problem when the error “Class does not exist” pops up
4. But there is a problem when 8.2 is installed, and then 8.1 is installed - try exchanging via OLE/COM with a standard UT-BP exchange!
5. Could you indicate the main processing on the site that allows you to universally connect via OLE/COM so that beginners do not waste time, you write for them! By the way, for some reason her picture is on your display, why? And as a result, 2 words on the merits, and 6 more behind the scenes.

In general, I don’t throw mud, but point out specific gaps, but there is zero reaction. If this is the experience you are sharing, then it is somehow erroneous and incomplete.
My point is that if the author had a desire to collect all the glitches, he could at least listen to other people’s experience, and not snap at comments. A situation immediately arises when the one who read it knows more than the author, they tell him (sometimes incorrectly), and he also fights back. As a result, all the information is not in the article, but in the comments! Funny! This often happens, but you don’t need to focus on the fact that you wanted the best - I show what’s best, and others show it! Include this in the article and it will be worthwhile; not everyone is interested in reading this skirmish.