Obtaining Unique Reference IDs via Queries

1C Developer team

16.11.2022 3 min

8_3_22_З UI.png

By popular demand, in version 8.3.22, we added function UUID(Reference) to the query language and the DCS expressions language. Parameter Ref is an expression that provides a reference (apart from references to tables in external data sources). The function returns a unique ID (UUID) of the passed reference or NULL where value NULL is passed.

This innovation should make it easier to integrate 1C:Enterprise systems with external systems.

Consider the following example. We have an integration with an external system at the data level: a table in the external system refers to catalog Products in our infobase.

The external system table structure:


 Key (number)


 Product Name in English (string)


 A reference to an element in catalog Products (unique identifier)

We need to retrieve the content of catalog Products on the 1C side and display the name of each product of the catalog in the English language.

Assume we managed to get the contents of the external table as a table of values (via a web service or an external data source, or in some other way).

Now we can link the records of the external table (located in the table of values) with the elements in catalog Products as follows:

1.     Add to the table of values a column for references to elements of catalog Products, and thus process all entries in the table of values in a loop.

2.     Using a query, merge the resulting table of values with catalog Products.

In version 8.3.22, we can do the same much more quickly.

Consider the code below as an example. The contents of the external table are placed in value table VT_ProductsExternal.

Query.Text =


| VT_ProductsExternal.Description AS DescriptionEN,

| VT_ProductsExternal.UUID AS UUID

|PUT ExtT_ProductsExternal


| &VT_ProductsExternal AS VT_ProductsExternal




| Products.Code AS Code,

| Products.Description AS Description,

| ExtT_ProductsExternal.DescriptionEn AS DescriptionEn,


| Catalog.Products AS Products

| LEFT JOIN ExtT_ProductsExternal AS ExtT_ProductsExternal

| BY UUID (Products.Ref ) = ExtT_ProductsExternal.UUID


Query.SetParameter("VT_ProductsExternal", VT_ProductsExternal);

Data = Query.Execute().Select();

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.