Contacts

1C format string. Format string. The main parameters of the format string

* .cf. - The file contains only the configuration (code and structure) without user data. Created from the 1C 8.x configurator: "Configuration -\u003e Save the configuration to a file" or "Configuration -\u003e Configuration Supply -\u003e Create a Supply File and Configuration File -\u003e Sign" Create Delivery File "".

* .cfu. - The file contains only a configuration update. For example file1cv8.cfu. Create a configuration from this file is impossible, as it contains only differences new configuration from the previous one. Created from the 1C 8.x configurator: "Configuration -\u003e Configuration Supply -\u003e Create a delivery file and updating configuration -\u003e Sign" Create a configuration update file ".

* .dt. - The file contains a configuration along with a user database. This is a specialized format of the archive 1C 8. Created from the 1C 8.x configurator: "Administration -\u003e unload information base."

* .epf. (* .erf.) - External processing file (report). Any processing (report) from the configuration can be saved by external. Created from the 1C 8.x configurator: "Configuration -\u003e Open configuration -\u003e We become on the desired processing (report) -\u003e We allocate the right mouse button -\u003e Save as external processing, Report ... "

* .1cd. - File full-fledged database. Presentation of the default name: 1CV8.1CD. Includes configuration, database, user settings. Opens 1C 8.x platform. Created to develop a new configuration automatically on the "Add" button when choosing a new item information base».

* .log, * .lgf, * .lgp, * .elf- Log files that collect information (register data) in 1C 8.0 8.1, 8.2, 8.3.

* CDN -file with such an extension ( 1cv8.cdn) serves for manual or automatic lock Database 1C Enterprise The eighth version.

* .mxl - Files of printed forms are used, including 1C. These are both printed forms of documents, reference books, reports, as well as various data storage devices for various classifiers. Opened via the configurator or in 1C mode: the company via "File -\u003e Open". It is created in the same way: in the configurator mode or in 1C: Enterprise through "File -\u003e New". Also, files with such extensions can serve as a transfer rules, for example, from 1C 7.7 to 8.2 (aCC77_82.xml and auxiliary processing EXP77_82.ERT) - they are usually in the ExtForms folder.

* .efd. - This is an archive file 1C, used to set the configuration. Contains or configuration 1C or update to it. It starts using the setup.exe auxiliary executing file (must be in one folder).

* .mft.- auxiliary file to create a configuration from the template. Contains configuration information, description, path, title. Used directly to the platform itself when creating an information base of 1C from the template.

* .grs. - Files of graphic circuits in 1C specialized format. Opened via the configurator or in 1C mode: the company via "File -\u003e Open". It is created in the same way: in the configurator mode or in 1C: Enterprise through "File -\u003e New".

* .geo.- Files of geographic schemes in 1C specialized format. Opened via the configurator or in 1C mode: the company via "File -\u003e Open". It is created in the same way: in the configurator mode or in 1C: Enterprise through "File -\u003e New".

* .st. - Text template files. Used mostly 1C developers.

* .pff. - File with saved performance measurements. Are used system administrators and 1C specialists.

Parameters:

<Значение>

Formatable value.

<ФорматнаяСтрока>

The format string is a string value that includes formatting parameters.

Formatting parameters are listed through the ";" symbol. The presence of a parameter means the difference between the formatting from the standard one.

If the parameter is not specified, the standard formatting is applied, which basically corresponds to the conversion of the value to the string. However, for the values \u200b\u200bof the type and the default date (0 and 01.0001, 00:00:00, respectively) an empty string will be issued.

Each parameter is set by the parameter name, the "\u003d" symbol and the value of the parameter. The parameter value may be indicated in single or double quotes. This is necessary if the parameter value contains the symbols used in the syntax format string.

Inside the value of the parameter, arbitrary characters may be indicated, which when generating the resulting string will be displayed as it is. Thus, for example, you can specify clock separators, minutes and seconds when formatting time. If these characters are coincided with the values \u200b\u200bof the format lines, they must be concluded in single quotes.

Names and values \u200b\u200bof the parameters of the format string:

  • L - the name of the language, countries for which standard formatting will be performed.
  • CHC is the total number of decimal discharges of the whole and fractional parts. The initial number is rounded in accordance with the rounding rules. If this parameter is specified, it is necessary to specify the CDC parameter to display the fractional part of the number. fractional part Display will not be displayed.
  • CDC is the number of decimal discharges in the fractional part. The initial number is rounded in accordance with the rounding rules.
  • Emergencies - Discharge shift: Positive - division, negative - multiplication. In other words, this means that the initial number will be multiplied or divided by 10 * C, where C is the value of the module parameter.
  • PSD - a symbol-separator of a whole and fractional part.
  • ЧHG - symbol-separator of groups of the whole number. If you use an empty string as a separator, then in this case the separator will be a symbol of an inseparable space.
  • CN - a string representing the zero value of the number. If not specified, the representation in the form of an empty string. If "CN \u003d" is specified, then in the form "0". Not used for numeric input fields.
  • CHVN - whether to remove the leading zeros. The value of this parameter is not specified, the result of the parameter determines the output of the leading zeros.
  • CHG - order of grouping of the digits of the number. As a value, numbers are indicated, through the comma, denoting the number of grouped discharges to the right left. It makes sense only the first two numbers. The first of them indicates the primary grouping, that is, the one that will be used for the least significant discharges of the whole part of the number. If the second number is not specified, only the least significant discharges will be grouped. If 0 is set as a second number, then the value specified for the primary group will be applied for all categories of the number. If a value other than 0 is used as a second number, this value will be used to group all discharges, except for the already grouped least significant.
  • Cho - representation of negative numbers.
    • 0 (0) - string of the form "(1,1)";
    • 1 (1) - a string of the type "-1.1";
    • 2 (2) - a string of the type "- 1.1";
    • 3 (3) - a string of the type "1,1";
    • 4 (4) - a string of the type "1.1 -".
  • DF - date format.
    • d - day of the month (numbers) without a leading zero;
    • dD - day of the month (numbers) with a leading zero;
    • dDD - brief name of the day of the week;
    • duddd-full name of the day of the week;
    • M - number of the month (numbers) without a leading zero;
    • Mm - number of the month (numbers) with a leading zero;
    • Mmm - brief name of the month;
    • Mmmm - the full name of the month;
    • to - the quarter number in the year;
    • m - number of the year without a century and leading zero;
    • gG - number of the year without a century with a leading zero;
    • yyyg - number of the year with a century;
    • h - an hour at 12 o'clock without leading zeros;
    • cC - hour at 12 o'clock with a leading zero;
    • H - an hour in 24 hour variant without leading zeros;
    • CC (HH) - an hour in 24 hour variant with the leading zero;
    • m - minute without a leading zero;
    • mm - minute with a leading zero;
    • c - second without leading zero;
    • sS - second with a leading zero;
    • bB - Display half of the day AM / PM (valid only for configuration languages \u200b\u200bthat support the 12-hour version of the time representation).
  • DLF - local date format. This indicates the display of the dates parts.
    • D - date (numbers);
    • DD - a long date (in words);
    • In - full time, the date can be combined with time;
    • DV - date time.
  • DP - a string representing an empty date (for example, the format ("00010101000000", "dp \u003d" "empty date" "") will return the string "empty date").
  • Bl - string representing a logical value False.
  • Bi - a string representing a logical value True.

Programming (and business programs) usually deal with the following simple data types: Number, line, date. The values \u200b\u200bof these types for different countries, standards and simply habits can have a different representation.

Probably the most famous example is a different presentation of time - in Russia to use 9:00 and 21.00, and in English-speaking countries 9am and 9pm. The difference is both in logic (12 hour system or 24x hour) and writing.

The representation of the value is called "format" and today we will discuss the change in the date and format of the number in 1C.
You can use formatting as a programmer in 1C, and visually, without programming, for example, when creating a printed form or a report when setting up the elements on the form.

What is formatting

The number and date regardless of its presentation on the screen or on the seal - remains itself. Formatting implies exclusively converting to a string value - that is, how it will "look" on the computer screen or on paper.

The main differences in the formats 1C representation of numbers and dates:

  • Number
    o "." or "," for the separation of the fractional part
    o Number of semicolons
    o Grouping numbers Among 3 (1 000 000, and not 10,000,000)
  • date and time
    o order of year, month, day
    o Symbol-separator
    o 1s time format (12 or 24 hours)
    o writing details.

Also in 1C format, additional "convenience" can be indicated, for example, negative numbers output red, or the "empty value" representation in the form "0" or "not filled".

Formatting principle

Formatting by default works, for example, when translating a number into a string. In some cases, such settings can serve as a bad service where the programmer does not expect this programmer.

For example, when translating the number in the string, it is translated to the grouping of the numbers (and you expect this?):
Number-frame \u003d CROLP (2400); // will be "2,400"

To accurately specify the 1C format, there is a format () function, with which it is possible to specify the desired view.
Number-frame \u003d Format (2400, "Settings")

As a string "Settings" you need to specify the required 1C format. Such settings are specified in a special encoded form. Consider the most frequently used settings:

Format 1C dates and default numbers

If you need to withdraw a date or number and do not want to bother with knowledge, how they should be presented according to the rules of the required country, there are simplest settingwhich will allow you to do this:

L \u003d short-natal-monopolisy

An example of the output of the date according to the rules of some countries:
Format (currentData (), "L \u003d RU")
> 28.03.2012 14:21:32

Format (currentData (), "L \u003d EN")
\u003e 3/28/2012 2:21:24 pm

Format (currentData (), "L \u003d FR")
> 28/03/2012 14:22:08

It is not difficult to notice, the names of countries are intuitive.

Date format in Language 1C

If the default settings are not enough and I would like to independently specify the order of parts of the date and the symbols of their separation, you must use the setting:
DF \u003d "DMG HRS"

Accordingly, DMG is a day, month and year, and the "CHMS" is a watch, minutes and seconds. You can skip any of these parts. The order of following is any. The characters specified between the parts will be used as separation symbols.

The symbol of part of the date can be specified several times in a row, the view of this part of the date, for example, "d" or "dd" or "dddd" depends on this.

Decryption of dates parts:

  • d - day
    o Little "D"
  • M - Month
    o big "m"
    o can be indicated from 1 to 4 times
  • g - year
    o Little "g"
    o can be specified 1 or 2 or 4 times
  • h - watch
    o Little "h" - 12 watch format
    o big "h" - 24x hour format
  • m - Minutes
    o Little "M"
    o can be specified 1 or 2 times
  • c - seconds
    o Little "C"
    o can be specified 1 or 2 times
  • bB - AM / PM mapping for 12 hour format
  • by - quarter.

An example of the output of the date indicating the rules:
Format (currentData (), "DF \u003d" "DD.MM.YYYY HCH: mm: ss" ")
> 28.03.2012 02:44:44

Format (currentDATA (), "DF \u003d" "M / D / GGGH H: M: from BB" ")
\u003e 3/28/2012 2:44:44 pm

Format (Current Data (), "DF \u003d" "DD / MM / GGGH HCH: mm: ss" ")
> 28/03/2012 02:44:44

The format of the number in Language 1C
In contrast to the date formatting, where everything is simple enough, there are many parameters for formatting a number. We will consider those that seemed useful to us - that is, in our opinion, often apply.

The first "problem" is associated with the default grouping of numbers in numbers 3 and the division of groups by a space, for example:
Stroscle \u003d Row (22300500)
> 22 300 500

This is inconvenient when the number is transformed into a string not for a beautiful and understandable output to the user, but for official needs. This can be affected by the "CHG" parameter, for example:

Format (22300500, "CG \u003d 100")
\u003e 22300500 // Long removed zeros

Format (22300500, "CG \u003d 6")
\u003e 22 300500 // made a group of only millions

The parameter that allows you to round the number when displaying to the desired number of numbers after the Switch "CDC":

Format (3.535353, "CDC \u003d" "2" ")
> 3,54

The parameter that allows you to specify the symbol-separator of the whole and fractional part "PSD":

Format (3.535353, "ChRD \u003d" "." "")
> 3.535353

For some cases it is useful to be able to display something else instead of the number "0": an empty string or "not filled". This allows you to make the "CN" parameter:

Format (0, "CN \u003d" "" "")
>

Format 1C field on format

We reviewed with you techniques that allow the programmer to format a value in Language 1C. There are also mechanisms that allow you to specify the required format visually, without programming.

For example, the user works with a form. On the form there is a field that displays the date. We can affect the presentation of this date.

Open the properties of this field. To do this, in the Tolstaya Client, right-click on the field, and in the thin button on the field name in the field list, select Properties.
The field has a "format" property.

Click the "..." button to configure it. To configure the date format, use the date tab (for the number - the number bookmark). You can select the desired format from the list.

1C Cell format in print format

When need to be developed printing form (Report or Print Document), you can assign a cell format in exactly the same way as for the document field.
Select the cell (or several cells at the same time), go into properties, the "format" property, select the required format.

1c format in SKD

CC reports allow you to configure 1C format as a programmer (at the time of the report) and the user (when using the report). Also more than the use of conventional formatting.

This means you not only specify which field to format, but also with what condition (for example, if the value of this field is negative).

In the Enterprise mode, select the menu item on the "Modify option" report. In the CCD report in the Tolstaya Client, this item in the Actions / Settings menu.

In the form of all settings of the CEF, there is a "Conditional Formatting" tab. Add a new line. In the line three columns:

  • Registration. Specify the desired 1c format - font, background color, or text format 1C Display of the number and date
  • Condition. If a this design Always apply - then leave this field empty. Otherwise, specify the field and its value. Then formatting will be applied only in those lines in which these values \u200b\u200bcoincide. If you want to specify the values \u200b\u200bof multiple fields at the same time and the conditions "and / or" - add a group and grouped the fields using groups.
  • Fields decorated. List of fields for which formatting will be applied.

1c format in managed forms

Similar formatting rules operate in any form of a managed client list. In the list form, select the menu item "All Actions / Configure List".

Laying conditional design.

Select the desired design and format.

We specify a list of fields to which this design will be applied.

The main types of data in 1C is the number, boolean and date, can be represented by many formats. Programmers are often faced with the fact that the requirements of the data type are greatly vary in different reports and tables. The 1C developers thought about the convenience of programmers and created special function, significantly facilitating the process of changing the appearance of the data. The main task of the function is to bring the number, date or logical type to listening String type.

Description of the function "Format"

The syntax of this feature is simple - you can transfer two parameters as parameters. First, the developer indicates the value that should be subjected to formatting. In order for 1C to understand how to change the value, the programmer specifies the second parameter as a string value containing predefined operands. It is the meaning of this string and determines which data will be displayed in the report.

Formatting \u003d format (varnaly formatting, text formattextrock);

If the "formameset" parameter is not specified, then 1C converts the specified value to the string. Remember that empty date and 0 will be converted to an empty string, which may not like to users. Each parameter in the format row is a combination of the name, the character "\u003d" and the values \u200b\u200bindicated in quotes. This allows you to involve the enclosure of the characters used in writing the format format format function in 1C.

In the data display, you can insert an arbitrary symbol with the exception of the format lines used in the syntax. If there is a need to get around this limitation - use single quotes. This solution will also help in situations where the character can be interpreted with the compiler incorrectly.

For the convenience of developers in 1c, a format string designer is built. You can contact it in modules through the context menu or in the SCD through the place provided by the developers. For example, this feature can be detected in the list of fields for the query in the "Design" section.

The most important advantage of the constructor is that you can immediately see how your data will look at the end. After you set the necessary settings for a specific type of data in the "Example" section, you demonstrate the result of your settings. In a unnamed text field at the bottom you will find a format string with which the result is obtained. It can be copied and used in the future if the result is fully arranged.

The format string designer can be a great help for novice developers, but experienced programmers prefer not to spend time on it. Development will be much faster if you know the main key options format parameters and use them without a constructor call.

The main parameters of the format string

Explore all available commands will not work, and this is not necessary. The developer is enough just to know some popular operations and how to apply them. At any time you can open the full list of parameters of the format string and select the desired one in the assistant syntax. The 1C programmer can use the following parameters in everyday operation:

  • L - the format of the country, for which the data will be displayed;
  • CG - sets the group of digits of the number;
  • CHC - establishes the total number of characters groups of the whole and fractional part of the number that will be displayed on view. If the value of the CDC parameter is not specified in the format row, the fractional part will not be shown;
  • CDC - a parameter defining the number of characters in the part after the comma. Rounding occurs in accordance with the standard rules of mathematics;
  • Emergencies - a parameter that shifters the discharges of the number. The value may be positive - multiplication by 10, or negative - division. Useful team if you need to be output in one form, and continue working with a number in another;
  • PSD - Specifies a symbol separating the fractional and integer part of the number. To set a symbol that shares the groups of the integer part, use "CHRG". To apply an inseparable space, use an empty string;
  • CHVN - shows the use of leading zeros. The value of this parameter is not specified;
  • DF is one of the most common format string parameters. Manages the date format. In 1C using the "Format" command, you can display the date in almost any format, including writing the name of the month. There are many possible values, their list can be seen in the assistant syntax;
  • BL and BI - establish a representation for a logical data type, responding, respectively, for lies and truth. Thus, the standard "tick" you can replace with any word or phrase, more intelligible for users.

The universalism and convenience of the designer became key causes of the popularity of the "Format" function among the developers 1C. Flexible settings will help you set any appearance Information on the request of the client.



Did you like the article? Share it