Desktop version

Main > Knowledge Base > Developer resources > Development recommendations > Query language > Specifics of working with the Presentation field and Presentation() function of the query language > Developer resources > Development recommendations > Query language > Specifics of working with the Presentation field and Presentation() function of the query language > Developer resources > Development recommendations > Query language > Specifics of working with the Presentation field and Presentation() function of the query language

Specifics of working with the Presentation field and Presentation() function of the query language

To display reference fields in a report, you need to get a reference field presentation in a query and use this presentation instead of the reference for displaying the field. This section describes some specifics of the Presentation field and the Presentation() function that get a presentation. For details on displaying reference fields, see Display of reference fields.

Presentation field

Each object table in the Infobase has a virtual Presentation field. This field contains text object presentation. You can retrieve this field in a query just like other table fields, but you cannot execute any operations with this field. This is due to the fact that this is a virtual field, and when you get this field from the database, the query actually gets multiple fields and converts the received values into a string after the query result is generated. Therefore, the only thing you can do with the Presentation field is to get it as a part of a query result.

Therefore, we recommend that you do not sort the query result by the Presentation field because it will have an unexpected effect: the query result will be sorted in the order of ascending object references. For details see Specifics of sorting by reference fields.

Presentation() function

The presentation function is intended to get a text presentation of any value that can be retrieved using the query language. The Presentation() function can be used both for reference and primitive types. For reference types, the function result is identical to getting the Presentation field from a reference passed as a function parameter. For primitive types, the function returns a string that is a result of the conversion of the value that has been passed as a parameter. A distinguishing feature of this function is that its result cannot be used in any expression. This feature is due to the fact that converting values into a string is performed when data is received from the query result since the conversion of an arbitrary value to a string upon query execution on the server-side is not performed because local settings should be taken into account when converting values to a string.

Using the Presentation() function has a number of advantages compared to using the Presentation field. For example, if the field from which a presentation is received can contain both reference and primitive types, getting the Presentation field from this field using . (dot) does not return presentations for the primitive values. But if you apply the Presentation() function to this field, a string presentation is generated irrespective of the value type in the field. In addition, if the Presentation() function is applied to a field that is a reference to more than three tables, the query language only gets reference values from the database while the presentation values are retrieved via one or more additional queries. This behavior makes retrieving presentations for the fields that reference a large number of tables (for example, fields that reference any catalog) more efficient due to the fact that the executed query does not include a large number of connections required to get the presentation fields.

The Presentation() function can also be handy when you get the presentation of an enumeration field and the query is executed via the COM connection.

Next page: Specifics of working with virtual table of calculation register schedule data




© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.