1C:Enterprise 8.3: several interesting innovations

Publications: 1C:Enterprise 8.3: several interesting innovations
Some things that interested me in the new 1С platform 8.3 - formatted strings, hash-functions and other.

Firstly, an object “DataHashing” appeared. Using the platform tools, it allows getting the MD5 or CRC32 hash. Takes as an input the string or “BinaryData”. Finally, it is possible to calculate hash MD5 without external components. Hurrah! It is done, for example, like this:

    &AtClient
    Procedure CountMD5(Command)

        Hash = GetMD5_Server(TextHash);
        Message = New UserMessage;
        Message.Text = Row(Hash);
        Message.Field = "FieldForHash";
        Message.SetData(Object);
        Message.Message();

    EndProcedure

    &AtServer
    Function GetMD5_Server(Text)

        ObjectHash = New DataHashing(HashFunction.MD5);
        ObjectHash.Add(Text);
        Return ObjectHash.HashSum;

    EndFunction

Search for details in the syntax-assistant.

* * *
Secondly, now it is possible to manage the object presentation. Yes! Now there is an event in the manager module for such objects as Catalog, Document, etc., in which you can form the presentation by yourself. This can be useful in a variety of cases - for example, to output the name of client or goods in different languages depending on the language of system user.
This can be done, for example, like this:

Manager module of catalog “Customers”

Procedure PresentationGetProcessing(Data, Presentation, StandardProcessing)
	
	StandardProcessing = False;
	
	If Data.Importance Then
		Presentation = "(!) " + Data.Description;
	Else
		Presentation = Data.Description;
	EndIf
	
EndProcedure

Procedure PresentationFieldsGetProcessing(Fields, StandardProcessing)
	
	StandardProcessing = False;
	
	Fields.Add("Importance");
	Fields.Add("Description");
	
EndProcedure

Look what we get as a result:

Publications: 1C:Enterprise 8.3: several interesting innovations

The presentation by formula “(!) ” + Description was automatically calculated when casting to the string for the message and in the input box of the catalog type.
Yes, this works also in the queries in the function “Presentation” and in the panel during debug. See for yourself:

Publications: 1C:Enterprise 8.3: several interesting innovations

Global feature!
Just do not forget that the presentation in configuration is made very often, and, therefore, the calls for this event will be VERY much. There is no need to write there the complex queries to the reserves. =)

* * *
Also the work with directories is improved. For example, now it is very simple to get the path to the directory of user documents using the function DocumentsDir().

It is said that everything works in the web-client too. So, now the problem “where to save the user report without asking him anything” does not exist.

* * *
The type “FormattedString” is added. Not mutable, serialized, allows creating such excellent warnings:

Publications: 1C:Enterprise 8.3: several interesting innovations

And the right caption is a reference. It is possible to click it and get into the catalog item.

* * *
There are actually a lot of the changes. See the official manual. I cited you what I decided to be interesting, but you probably will be interested in quite another things.
There is some about DCS, navigation links, and external data sources. A lot of interesting things.

Click to rate this post!
[Total: 0 Average: 0]

Leave a Reply

Your email address will not be published. Required fields are marked *