Specifics of database string comparison

1C:Enterprise functionality consists of two parts: operations performed in computer memory (at client or at server) and operations performed using DMBS tools (these include queries, many global context methods, and many applied object methods).

Although 1C:Enterprise type system is almost identical to that of the database, there are some differences. In particular, there is an important difference in string comparison operations. In 1C:Enterprise script, string comparisons are case-sensitive. In database operations, they are case-insensitive.

Of course, to perform case-insensitive comparison using script tools you can convert both strings to all uppercase or all lowercase letters. For example:

  • "F" = "f" returns false;
  • Upper("F") = Upper("f") returns true.

When using queries or performing other database operations, remember that the comparison is case-insensitive.

This affects the numbering feature. Codes and numbers of applied objects (catalogs, documents, and so on) are case-insensitive because they are maintained by database tools. If you attempt to set a new object code that differs from an existing code only by character case, you get the exception "Number field value not unique!". Code and number prefixes are also case-insensitive. A user-friendly solution uses only capital characters in codes and numbers.
If your script contains an algorithm whose logic must be identical to the logic of database operation (for example, a text search), you might want to convert all strings to uppercase letters in the script to ensure that the comparison is case-insensitive.

Next page: Specifics of TypeDescription object

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.