Building a query text depending on DCS parameters

Common questions about 1C:Query language, Query builder tool and Data composition schema

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jul 18, 2012
Company: Osaka University

Hello! I am building a report using Data composition schema, and it should contain different data sources depending on the query parameters. When I need to filter by some attribute I use WHERE clause, but when I need to get data fr om different tabular sections I'm a little confused. How can I make a query wh ere data should be obtained from different tabular sections of catalog depending on DCS parameter value?

 
#2
People who like this:0Yes/0No
Active user
Rating: 6
Joined: Sep 16, 2011
Company:

Hi, Nobuyuki Susumu!
You can work with tabular sections as with ordinary tables, for example if you need all data of ContactInformation tabular section of Companies catalog for specific company, you need to use the following query:

Code
SEL ECT * 
FR OM Catalog.Companies.ContactInformation AS ContactInformation 
WHERE ContactInformation.Ref = &Company

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jul 18, 2012
Company: Osaka University

I see, thank you, Xin Wang!
So, I've solved my problem using UNION clause and adding conditions for rows in the following way:

Code
SELECT 
    KitContent.Item, KitContent.Quantity 
FROM Catalog.Items.KitContent AS KitContent 
WHERE &UseKits
UNION ALL
SELECT 
    BOM.Item, BOM.Quantity 
FROM Catalog.Items.BOM AS BOM 
WHERE &UseBOMs


Hope that will help someone else

Edited: Nobuyuki Susumu - Aug 12, 2012 08:29 PM
 
#4
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 2, 2011
Company:

You can try to use report variants for separate your scopes

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
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.