⬆️ ⬇️

Placement of the table of values ​​with the help of additional requisite and expansion of the 1C configuration

I am often asked how to add a table to a document or directory?

And really, how to make such a task without complicating the further configuration update? And there seems to be extra. details and add. information, but why can't they take the type of table of values?



As a result, 2 options are most often used:



1. Easy way. A table is added directly in the object, and then either programmatically or hard (manually) is displayed on the form.



Minuses. Updating the configuration will require compliance with the changes and extra care, so as not to lose these changes.

Pros. The easiest option to develop, the table of values ​​can be accessed without dancing with a tambourine, for example, through queries.


2. The normal option, but also with the refinement of the configuration.

An object is added with a table of values ​​and a prop with a link to the parent object, this table of values ​​is displayed, for example, through the configuration extension on the form of the main object.



Pros. A simple update, the table of values ​​can be accessed, for example, through queries.

Minuses. It requires more to provide for various restrictions on the created object and, therefore, requires certain knowledge. You may need to add a role to it and customize user profiles.


There are, of course, other options for the storage example, but the article is not about that ...



An article about how to still store a table of values ​​in the add. details, well, or in the add. information.

')

I have been keeping this method in mind for more than half a year, but have never used it. Here, finally, got his hands. I do not claim that no one invented this method, but I did not stumble upon such a decision. I will say in advance, the option is not perfect, and will fit only for certain tasks.



The main disadvantage is that a string of unlimited length will be used, and therefore there will be certain difficulties with the search. The main plus, the objects in the configuration do not correct.



An example will demonstrate on the configuration Document Management 2.1.6.8. I will use additional props, but you can use additional information. All code will be written in the Extension Configuration.



Task:

Immediately I say the problem is more comic to demonstrate the method. For example, we needed to add the tabular part “Adequacy of contact persons”, it should be present in the Counterparty directory and contain columns: Contact person, Council (some recommendation for communicating with the contact person), Type of contact.



1 Add extra. props and call it for example "TZ_AdequacyContact Persons".

I make this prop common for all types of counterparties. Its type will be a string of unlimited length.







2 We create an Expansion configuration and modify the form of counterparties.

Add form details:



- “DopTZ” type of Plan SpeciesCharacteristicsLink.AdditionalRequisitionIntroduction

- TZ_AdequacyContact Persons type Table Values:

Contact Person Type Directory Reference. Contact. Person

Contact type String

Tip type String







Add to the form a page “Group Adequacy of Contact Persons” and remove the visibility.

In this group we deduce "TZ_Adequacy of Contact Persons"







3 Write the code.

At Creation on the Server. It is necessary to consider the additional requisite itself. We remind him that they called him "TK_Adequacy of Contact Persons", then read its value and construct a value table using its value.



I propose to store the value of additional properties in the JSON format, for whom the older platform can use XML.



 _(, ) //   //_ -         = ..("_");  ()  //         .. = ; //     = ..( ("", ));  = ?(.() = 1, [0]., ); //      JSON   <>   // JSON JSON =  JSON; JSON.();   = JSON(JSON);   = ""; ; //    JSON   // _  () = ("")         = _.(); //           . = GUID(.,"."); . = .; . = .; ; ; ; ;  //         &  GUID(GUID,)  =;  (" = "++".( ("""+GUID+"""));");  ;  ;  




At the opening. Program hiding add. props. It stores JSON, so the user is not particularly interested.



 &  _()  ()  //       //_ -  ,       .  = ._.( ("", )); //    .() = 1  [[0].]. = ; ; ;  


Before writing to the server. If TK has changed, save it as a JSON string in the add. props.



  _(, , )  ()  //_ -  ,       .  = ._.( ("", )); //      JSON JSON =  JSON(JSON., " " , , JSON., , , , ); JSON =  JSON; JSON. = ; JSON.(JSON); //     _  =  ;     _  .( (",,", (..()), ., .)); ; //    JSON JSON(JSON, ); JSON = JSON.(); //         [[0].] <> JSON  [[0].] = JSON; ; ;  


Source: https://habr.com/ru/post/310930/



All Articles