I have to use UUID("00000000-0000-0000-0000-000000000000") in a query under where condition. But when I was using, I got error. Could you help me please? I'm trouble in with this.
For example;
Code
SELECT
SalesInvoices.Ref.CurrentAccounts,
SalesInvoices.Variants
FROM
Document.SalesInvoices.Variants AS SalesInvoicesVariants
WHERE
SalesInvoicesVariants.Ref.Date >= &StartDate
AND SalesInvoicesVariants.Ref.Date <= &EndDate
AND SalesInvoicesVariants.Ref.CurrentAccount<> VALUE(Catalog.CurrentAccount.EmptyRef)
AND SalesInvoicesVariants.SourceDocumentLineUnicID =
VALUE(UUID("00000000-0000-0000-0000-00000"))
To make this work you should pass UUID("00000000-0000-0000-0000-00000") as a parameter and use this parameter in your query.
Code
SELECT
SalesInvoices.Ref.CurrentAccounts,
SalesInvoices.Variants
FROM
Document.SalesInvoices.Variants AS SalesInvoicesVariants
WHERE
SalesInvoicesVariants.Ref.Date >= &StartDate
AND SalesInvoicesVariants.Ref.Date <= &EndDate
AND SalesInvoicesVariants.Ref.CurrentAccount<> VALUE(Catalog.CurrentAccount.EmptyRef)
AND SalesInvoicesVariants.SourceDocumentLineUnicID = &EmptyUUID
Code
Query.SetParameter("EmptyUUID", New UUID("00000000-0000-0000-0000-000000000000"));
But what about some special function like UUID.EmptyValue(). Basically we need to eliminate empty values and there is no way to do it without pasing params.
We understand your point on having a method or a property that would indicate whether the UUID is empty as it is a typical functionality of UUID/GUID-related libraries. We can suggest the idea to our developers but cannot guarantee they accept it and implement it quickly.
Meanwhile, the only reasonable way to check whether the given UUID is empty is by using query parameters as it was mentioned earlier.
A more sophisticated method to compare UUID values in your 1C:Enterprise queries is by using temporary tables. You create a temporary table for the data your want to compare from one side, without a UUID column, but with a string column instead, and fill the table with data. You use your 1C:Enterprise script to cast UUID values to string values in this column. Similarly, you create a temporary table for the data you want to compare from the other side and fill it with data. Ultimately, in your 1C:Enterprise query you compare string values in the tables' columns and fetch data from the tables.
For instance, if your task is to locate empty UUIDs, you can create a single temporary table and compare its UUID-representing string column values with the "00000000-0000-0000-0000-00000" string in your query.
We have forwarded this feature request to our developers. We agree that this feature would be beneficial, though let me repeat that we cannot guarantee that this feature will be implemented and when it will be implemented.
Vladimir, I have a great luck of having implemented fair amount of my requirements over the years. So I am not expecting it to happen any time soon, but it is always great to see something implemented that you have asked some time ago. Keeping my fingers crossed.