Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > CONTAINTS in 1C Query

Forum

Search UsersRules
CONTAINTS in 1C Query
#1
Interested
Points:: 0
Joined:: Nov 10, 2011

Hello!

I have this Query but I would like to use like in SQL CONTAINS:

Code
SEL ECT
   Addresses.Owner,
   Addresses.City,
   Addresses.State,
   Addresses.ZIP,
   Addresses.Owner.Description
FR OM
   Catalog.Addresses AS Addresses

ORDER BY
   Addresses.State DESC
CONTAINS "Trafik" //// ---- HERE I get an Error


Is there some similar to CONTAINS in 1C Platform?
Thank you for every advice!

Regards,
Lioudmila

Profile
#2
Administrator
Points:: 0
Joined:: Oct 3, 2019

Hello Lioudmila!

You need to use the following code:


Code
   Query = New Query;   
   
   Query.Text = 
      "SELECT
       |   Addresses.Owner AS Owner,
       |   Addresses.City AS City,
       |   Addresses.State AS State,
       |   Addresses.ZIP AS ZIP,
       |   Addresses.Owner.Description AS OwnerDescription
       |FROM
       |   Catalog.Addresses AS Addresses
       |WHERE
       |   Addresses.Description LIKE &Description
       |
       |ORDER BY
       |   State DESC"
      
   Query.SetParameter(Description, "%Trafik%");


Note the "%Trafik%":
if you use the symbol "%" - there can be any sequence of arbitrary characters;
if you use the symbol "_" - here is also any symbol, but only one.

Aleksandr

Profile
#3
Interested
Points:: 0
Joined:: Nov 10, 2011

Hello Aleksandr,

thanks a lot! It was not exactly what I needed because I have this Query in MainDataCompositionSchema.

Now it looks so:

Code

SEL ECT
   Addresses.Owner,
   Addresses.City,
   Addresses.State,
   Addresses.ZIP,
   Addresses.Owner.Description
FR OM
   Catalog.Addresses AS Addresses
WHERE Addresses.Owner.Description LIKE &Description   

ORDER BY
   Addresses.State DESC



and I made a Parameter Description (String) and in the Expession "%Trafik%".
It works!

Thanks a lot!
Regards
Lioudmila

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



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