You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user-guide/query-builder.md
+61-31Lines changed: 61 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,39 +26,55 @@ A query is just a set of instructions that tells the system what data you want f
26
26
27
27
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.
28
28
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:
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:
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.
44
74
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
-

75
+
[Video Link]
58
76
59
-

60
-
61
-
## Query Builder Areas
77
+
## Query Builder Structure
62
78
63
79
The following sections describe the function of each area
64
80
@@ -157,6 +173,20 @@ When you click Save, the [SqlDataSource Wizard]({%slug telerikreporting/designin
157
173
158
174
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.
159
175
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
+

187
+
188
+

189
+
160
190
## See Also
161
191
162
192
*[Getting Started Video Tutorial Part 1](https://www.youtube.com/embed/L-utkcB8-5c?si=bmJU9ggpSOykHdLK&start=188)
0 commit comments