Skip to content

Commit a82e786

Browse files
authored
Update query-builder.md
1 parent a054e96 commit a82e786

File tree

1 file changed

+61
-31
lines changed

1 file changed

+61
-31
lines changed

user-guide/query-builder.md

Lines changed: 61 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,55 @@ A query is just a set of instructions that tells the system what data you want f
2626

2727
The graphical query builder helps you find information in a database without writing code. You can click to choose the tables and columns you need, and then see the results. If you use more than one table, you need to show how the tables are connected.
2828

29-
Advantages of Using the Query Builder
30-
31-
* __Intuitive Query Creation__ - The graphical interface lets you create SQL queries by clicking and selecting options instead of writing code. This makes it simple to use and helps avoid mistakes.
32-
* __Faster Development__ - You can create even complicated queries easily by dragging and dropping items. The system will automatically create the necessary JOIN relationships between related tables, so you don’t need to set them up manually
33-
* __Immediate Result Preview__ - The Query Builder lets you see the results of your query before you add them to the report. This helps you make sure everything looks correct and saves time.
34-
35-
## Steps to Create a Query Builder
36-
37-
1. __Select the SQL Data Source__ - In the `Select Statement` section, choose the SQL Data Source you want to use.
38-
1. __Apply Schema Restrictions__ - Next, select the [Schema restriction]({%slug user-guide/query-builder%}#schema-restrictions) that applies to your chosen SQL Data Source.
39-
1. __Open the Query Builder__ - Click the `Query Builder` button. A new window will open where you can build your SELECT statement. Inside this window, you will find four main sections:
40-
* [Selected Fields]({%slug user-guide/query-builder%}#selected-fields-pane)
41-
* [Relationships]({%slug user-guide/query-builder%}#relationships-pane)
42-
* [Filters]({%slug user-guide/query-builder%}#filters-pane)
43-
* [Result]({%slug user-guide/query-builder%}#result-pane)
29+
The graphical Query Builder in the Web Report Designer has the following advantages:
30+
31+
* __Intuitive Query Creation__—The graphical interface lets you create SQL queries by clicking and selecting options instead of writing code. This makes it simple to use and helps avoid mistakes.
32+
* __Faster Development__—You can create even complicated queries easily by dragging and dropping items. The system will automatically create the necessary JOIN relationships between related tables, so you don’t need to set them up manually
33+
* __Immediate Result Preview__—The Query Builder lets you see the results of your query before you add them to the report. This helps you make sure everything looks correct and saves time.
34+
35+
## Building Your First Query
36+
37+
To create a query using the Query Builder in the Web Report Designer:
38+
39+
1. [Create]({%slug web-report-designer-user-guide-getting-started%}) an new report.
40+
2. Add an [SQL Data Source item]({%slug web-report-designer-user-guide-components-data-sources%}#sql-data-source).
41+
3. Connect to the desired SQL Data Source.
42+
43+
> To follow along the steps below, use the AdventureWorks database.
44+
45+
5. In the **Select statement** section, use the following query:
46+
47+
````SQL
48+
SELECT
49+
[Production].[ProductCategory].[ProductCategoryID],
50+
[Production].[ProductCategory].[Name]
51+
FROM [Production].[ProductCategory]
52+
````
53+
6. (Optional) Apply any [Schema restrictions](#schema-restrictions) that apply to your chosen SQL Data Source.
54+
7. Click the **Query Builder** button.
55+
8. In the new window, build your SELECT statement:
56+
57+
8.1. In the left pane (the DataBase view), select the `Name` field from the `ProductCategory` and the `ProductSubcategory` tables.
58+
59+
8.2. In the **Add relationship** window, select the fields (`ProductCategoryID`) that link the two tables and click **Save**.
60+
61+
8.3. Select the `Name` field from the `Product` table.
62+
63+
8.4. Define the relationship between the `ProductSubcategory` and `Product` tables through the `ProductCategoryID` fields and then click **Save**.
64+
65+
8.5. Select the `ListPrice` field from the `Product` table.
66+
67+
8.6. Set the alias (display name) for each column.
68+
69+
8.7. To reduce the number of records that will be displayed, add a filter. For example, products with list price between 100 and 500.
70+
71+
9. To preview the query and the resulting data, expand the **RESULT** section and click **Preview**.
72+
73+
10. Click **Save** to confirm your query.
4474

45-
Video
46-
47-
### Schema Restrictions
48-
49-
The Web Report Designer’s Query Builder has an option called `Schema Restrictions`. This option lets you choose which parts of the database to load by listing them with commas. It helps report creators see only the needed information and makes loading faster.
50-
51-
````
52-
null,Production,ProductCategory
53-
````
54-
55-
> Schema restrictions are sensitive to uppercase and lowercase letters, and empty values are allowed. If you need to set a value to nothing, use the word null as shown in the example. These rules only work with .NET 8 or newer.
56-
57-
![Image of the SQL Data Source wizard showing the schema restrictions field ><](images/SchemaRestrictionsQueryBuilderWDR_1.png)
75+
[Video Link]
5876

59-
![Image of the SQL Data Source wizard showing the query builder dialog ><](images/SchemaRestrictionsQueryBuilderWDR_2.png)
60-
61-
## Query Builder Areas
77+
## Query Builder Structure
6278

6379
The following sections describe the function of each area
6480

@@ -157,6 +173,20 @@ When you click Save, the [SqlDataSource Wizard]({%slug telerikreporting/designin
157173

158174
The Query Builder keeps your current settings. But if you change the SQL query manually and then use the Query Builder again, it will replace your changes with its own version.
159175

176+
### Schema Restrictions
177+
178+
The Web Report Designer’s Query Builder has an option called `Schema Restrictions`. This option lets you choose which parts of the database to load by listing them with commas. It helps report creators see only the needed information and makes loading faster.
179+
180+
````
181+
null,Production,ProductCategory
182+
````
183+
184+
> Schema restrictions are sensitive to uppercase and lowercase letters, and empty values are allowed. If you need to set a value to nothing, use the word null as shown in the example. These rules only work with .NET 8 or newer.
185+
186+
![Image of the SQL Data Source wizard showing the schema restrictions field ><](images/SchemaRestrictionsQueryBuilderWDR_1.png)
187+
188+
![Image of the SQL Data Source wizard showing the query builder dialog ><](images/SchemaRestrictionsQueryBuilderWDR_2.png)
189+
160190
## See Also
161191

162192
* [Getting Started Video Tutorial Part 1](https://www.youtube.com/embed/L-utkcB8-5c?si=bmJU9ggpSOykHdLK&amp;start=188)

0 commit comments

Comments
 (0)