Menu
Is free
registration
home  /  Education/ The predefined element is missing in the data 1c 8.3. Setting predefined items

The predefined item is missing from data 1c 8.3. Setting predefined items

Good day.

Today we'll talk about an innovation in the 8.3 platform regarding predefined elements.

Introduction

Let me remind you that earlier, in practice, very often I wanted to look at a directory element to find out its predefined name. For example, you have created two predefined contractors and named them IPSidorov and OOOMeteor. And they sewed some kind of logic on them.

When everything was debugged and worked, it turned out that the task was set the other way around and the logic for the sole proprietor is needed for the LLC, and the logic of the LLC is for the sole proprietor. “No problem,” we say, and in enterprise mode we rename the items. It's much more difficult to get into the code. A year passes and you are given a new task: to set up some more logic for IP Sidorov. You go into the configurator, write the logic, start checking and nothing works, because in the configurator of IPSidorov, and in the enterprise - OOO Meteor. The brain is broken and I want to destroy this rake. The simplest and most intuitive is to output the name of a predefined element in the form of a list. Here is an ambush, you can get the name of the predefined in 8.2 only by the method. And the method has its own inconvenience, it cannot be obtained in the request. Those. the first inconvenience is to get the name of the predefined one by reference to the directory.

The second inconvenience is when we already have a directory element and we need to make it predefined. We create a predefined item and get two items in the directory. One predefined, another working, which is referenced by all of our documents. Replacing links certainly helps, but if the database is large, then it's hard.

Now on business

The first is that the reference book now has the "Update predefined data" property.

What does this field give us? If it is set to "Do not update automatically", then by adding a predefined element, we will not see it in the reference immediately. Those. metadata has nothing to do with data. And if it is not created in the directory, then referring to it by its name through the directory manager will cause a syntax error.

Very interesting, but why? How do we create an item in the reference? And as you wish, you can create, or you can link it with an existing one. Now the lookup has the "PredefinedDataName" attribute. We create a catalog item programmatically as usual through "References.Contractors.CreateElement ()" and fill in its "PredefinedDataName" attribute equal to the name of the predefined item. Or, if the element already exists, we get its object and again fill in the "PredefinedDataName" in it. Everything.

And lastly, a little syrup

This new props is not only read / write, but also available in requests. Thus, you can impose conditions on it in queries, determine whether it is predefined or not.

Thank you for the attention.

The very idea of ​​programmatically working with predefined elements, in my opinion, is very correct. There are just some nuances that need to be taken into account when working.

First, you need to clearly understand for yourself that there are predefined elements in the configuration and there are predefined elements in the infobase (IB). Technically predefined IB elements are the most common elements of dictionaries, in which the "PredefinedDataName" attribute specifies which predefined configuration element they correspond to. They are no more different from ordinary elements. Accordingly, any ordinary IB element can be made predefined, any predefined ordinary. To do this, just enter the desired value in the props. "PredefinedDataName".

Periodically, this property turns out to be not the value that the developer provided. As a result, errors occur in the work of 1C. From critical, in which work is in principle impossible, to non-critical, in which the logic of the algorithms is violated.

It can be conditionally distinguished three types of errors:
1. "The predefined item is missing from the data";

3. Invalid indication predefined element;

1. "A predefined item is missing from the data" - o The absence of a predefined element described in the configuration in the IB data.

This is the easiest type of error to debug and fix. Its simplicity is that the platform correctly enough reports about this situation "A predefined element is missing from the data" and it is quite clear how to fix it.

When accessing the missing element in the code "Directories.Types of ContactInformation.EmailContactPerson" the message is displayed

When accessing an element in the request "VALUE (Directory.Types of ContactInformation.EmailContactPerson)", the following message is displayed:

This error occurs if an element is described in the configuration, but the element is not associated with it in the database.

To begin with, let's clarify that this situation is not always wrong. It is quite possible to use predefined data in some kind of program logic, which for most users may not be used. In this case, in order not to clutter up the reference book for all users of the configuration, it is logical to define predefined elements in the configuration, but not to create them in all information security systems, but only for those information security systems in which the required configuration logic is used. In this case, the programmer can specify the "Do not update predefined data" property for the reference book and create elements programmatically when accessing the module's functionality. Or to enable the user to independently bind the predefined elements of the module to the usual elements he has.

Also not used automatic creation predefined elements when operating in RIB mode. Since new elements should be transferred from the central base, and not created in nodes with different UIDs.

Those. sometimes it is a mistake to refer to an unmatched item, rather than the very presence of such an item.

You need to analyze why the item was not created. Perhaps it should be created when some mode of the program is executed. For example, after performing an exchange in the RIB. Or perhaps it was just accidentally deleted.

If the logic provides for filling in predefined elements not automatically, but in a separate mode, then before using the call by name " Directories.Types of ContactInformation.EmailContactPerson"To prevent an exception, it is advisable to check that the element is already in the database. If the element is absent, then inform the user about it and explain what mode he needs to execute to fill the element. For such a check, you can run a query on the data.

Request = New Request; Request.Text = "SELECT | Kinds of Contact Information.Link | FROM | Directory.Types of Contact Information AS Kinds of Contact Information | WHERE | Kinds of Contact Information. PredefinedData Name =" " EmailContactPerson"" "; ElementNoNo.VD = Request.Run (). Empty ();

If this is still an error in the database data, then it is necessary to bind to a predefined element of the IB element. Those. it is necessary to explain to the system which element of information security should be addressed program code on given name... Technically, binding is just specifying the name of a predefined element in a property "PredefinedDataName"IB element. To install it, just run the code:

2. "The predefined element is not unique" - h advoi predefined elements:

This situation consists in the fact that several IB elements are bound to one predefined element. In this case, when referring to a predefined name, the element will be selected at random. This situation is always wrong. Its difficulty is that the platform does not communicate about it in any way. It's just that the algorithms start to work incorrectly.

The framework will only report the "Predefined item is not unique" error when trying to edit a duplicated item.

Until no one needs to edit the element, no one will know about the error.

Such duplicates can be created, for example, if the RIB is used for the reference book and the "Update automatically" mode is specified in the properties for predefined data. In this case, when the exchange is performed, one instance of the predefined data will be created when the configuration is updated. A second instance of predefined items with the same name will be transferred from the central database during the exchange.

Also, these duplicates will arise when using exchange processing between configurations in the event that different information security elements correspond to predefined elements in different databases. In this case, one copy of the predefined data already exists in the database, the second will come when loading data with a different UID. If you are performing data transfers, you need to decide which database elements are considered primary and use them in the subordinate database. In the subordinate base, it is necessary to replace the use of old elements with elements of the main base.

Such errors in the database can be detected by a query of the form:

SELECT Kinds of Contact Information .PredefinedData Name, QUANTITY (DIFFERENT KINDS OF CONTACT INFORMATION.Link) AS A NumberPredefined From the Directory.Types of Contact Information AS Kinds of Contact Information.

This query will return a list of predefined elements with more than one IB element associated with it.

If there are such elements, it is necessary to remove the connection with the predefined one for one of them. Those. it is necessary to unambiguously determine for the system which IS element the program code should refer to when using this name. To do this, you just need to execute the code.

3. Invalid indication of a predefined element.

The error lies in the fact that the predefined element corresponds to the wrong element, which is provided by the program logic. Such errors are the most difficult to diagnose. Unlike the first two types, you cannot automatically check the configuration for these errors. They can only be identified by analyzing the logic of work. If in doubt, you can check if the correct item is being used.

To do this, just execute one of the commands.

// Definition of an IB element that is tied to the required predefined Report (Directories.Types of ContactInformation.EmailContactPerson) // Determine the predefined element to which the selected Report is tied (ReferenceOnItem.Name of PredefinedData)

If such errors are found, it is necessary to remove the incorrect link with the old element and add a link with the new element. The opcode is similar to the correcting code for the first two types of errors.

Well, briefly about the errors when programmatic work or in configurator mode:

"The predefined item does not belong to<Имя справочника>" - an error occurs when trying to write a predefined element with a name that does not match the name in the co-configurator.

"Non-predefined objects cannot have predefined subconto type entries" - an error occurs when you try to make a predefined chart of accounts element undefined. To eliminate errors, it is necessary to uncheck the "Predefined" flag for each line of the element's subcontract.

"Non-predefined objects cannot have predefined records of leading types of calculations"- an error occurs when you try to make a predefined element of a chart of calculation types undefined. To eliminate errors, it is necessary to clear the "Predefined" flag for each line of the leading type of element calculation.

"Predefined items are not unique"- an error is generated in the configurator when updating information base for a configuration release without 8.3.4 compatibility mode. It is necessary to check duplicates and eliminate them before updating.

"The name of the predefined element is not unique" - the error occurs if there are several predefined elements of the same name in the configuration when updating to the platform8.3.6.2332 and later. It is necessary to eliminate duplicates in the configuration.

For working with predefined data, I recommend processing. She knows how to perform any actions with predefined data, and can also check the configuration as a whole for the presence of errors of the first two types (duplicated and missing elements) in all information security objects (reference books, charts of accounts, PVC, PVR).

Simple handling to work with predefined values.

Allows you to match IB elements with elements predefined in the configuration.

Allows you to check the overall configuration for the presence of duplicated (several IB elements tied to one predefined element - an error) and missing elements (predefined elements that are not associated with IB elements - an error). Such elements could arise during exchanges or failures and lead to errors in the configuration.

You can just view the current values, you can make any necessary changes.

Operating procedure:

1. We start processing.

2. We select the type (reference book, chart of accounts, PVC, PVR).

3. We select the directory of the selected type itself.

4. All predefined elements available in the IB and described in the configuration appear in the tabular part of processing.

If there are several elements in the database that are bound to one predefined property, or some of the elements described in the configuration are not assigned IB elements, the system will inform you about this when you select a reference book. Duplicated and missing items appear at the top of the list and are highlighted in orange.

5. We set new values ​​for the required predefined elements.

In this case, lines are marked with red, for which a predefined element disappears from the configuration. Blue lines for which a predefined element changes, green lines for which a predefined element appears.
With a large number of duplicates, it is convenient to select with the mouse all unnecessary lines and indicate for all selected the undo link with the "Unmatch" button (since version 1.3.1)

6. We carry out the reassignment by clicking the "Execute reassignment of elements" button.

Checking duplicates(error "The predefined item is not unique"):

When you press the "Check duplicates" button, the processing will check all directories, charts of accounts, PVC and PVR and display a list of tables with duplicated elements indicating the number of duplicated elements.

After that, you need to check separately the objects for which errors were found.

Checking missed(error "A predefined item is missing from the data"):

When you click the "Check missing" button, the processing will check all reference books, charts of accounts, PVC and PVR and display a list of predefined elements that are not associated with IB data.

Requires platform 8.3.3 or higher to use.

Versatile, can be used with any configuration.

Detect language Afrikaans Albanian Arabic Armenian Azerbaijani Basque Bengali Belarusian Bulgarian Catalan Chinese (Simp) Chinese (Trad) Croatian Czech Danish Dutch English Esperanto Estonian Filipino Finnish French Galician Georgian German Greek Gujarati Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Kannada Korean Lao Latin Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Tamil Telugu Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Afrikaans Albanian Arabic Armenian Azerbaijani Basque Bengali Belarusian Bulgarian Catalan Chinese (Simp) Chinese (Trad) Croatian Czech Danish Dutch English Esperanto Estonian Filipino Finnish French Galician Georgian German Greek Gujarati Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Kannada Korean Lao Latin Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Tamil Telugu Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish