docs(query-builder): add Query Builder Model topic#6072
Conversation
Otixa
left a comment
There was a problem hiding this comment.
The whole conditionName: IgxStringFilteringOperand.instance().condition('endsWith').name reads a bit weird, to be honest, but it's technically correct and it illustrates where you can get the conditions and names.
Co-authored-by: Galina Edinakova <gedinakova@infragistics.com>
| iframe-src="{environment:demosBaseUrl}/interactions/query-builder-sql-sample" > | ||
| </code-view> | ||
|
|
||
| ## Request data from an Endpoint |
There was a problem hiding this comment.
Move this section before the SQL Example section
|
|
||
| ## Request data from an Endpoint | ||
|
|
||
| The demo below demonstrates how the [`IgxQueryBuilderComponent`]({environment:angularApiUrl}/classes/igxquerybuildercomponent.html) expression tree could be used to requets data from an endpoint [Northwind WebAPI](https://data-northwind.indigo.design/swagger/index.html) and set it as [`IgxGridComponent`]({environment:angularApiUrl}/classes/igxgridcomponent.html) data source. |
There was a problem hiding this comment.
| The demo below demonstrates how the [`IgxQueryBuilderComponent`]({environment:angularApiUrl}/classes/igxquerybuildercomponent.html) expression tree could be used to requets data from an endpoint [Northwind WebAPI](https://data-northwind.indigo.design/swagger/index.html) and set it as [`IgxGridComponent`]({environment:angularApiUrl}/classes/igxgridcomponent.html) data source. | |
| The demo below demonstrates how the [`IgxQueryBuilderComponent`]({environment:angularApiUrl}/classes/igxquerybuildercomponent.html) expression tree could be used to request data from an endpoint [Northwind WebAPI](https://data-northwind.indigo.design/swagger/index.html) and set it as [`IgxGridComponent`]({environment:angularApiUrl}/classes/igxgridcomponent.html) data source. |
|
|
||
| In the event handler, could be called an `HttpClient` POST request that accepts an endpoint url and body - the [`IgxQueryBuilderComponent`]({environment:angularApiUrl}/classes/igxquerybuildercomponent.html) `expressionTree`. | ||
|
|
||
| After subscribing to the request, the received data should be parsed to proper data type and set it as data source of the [`IgxGridComponent`]({environment:angularApiUrl}/classes/igxgridcomponent.html). |
There was a problem hiding this comment.
| After subscribing to the request, the received data should be parsed to proper data type and set it as data source of the [`IgxGridComponent`]({environment:angularApiUrl}/classes/igxgridcomponent.html). | |
| After subscribing to the request, the received data should be parsed to a proper data type and set as the data source of the [`IgxGridComponent`]({environment:angularApiUrl}/classes/igxgridcomponent.html). |
Co-authored-by: Galina Edinakova <gedinakova@infragistics.com>
Co-authored-by: Galina Edinakova <gedinakova@infragistics.com>
Co-authored-by: Galina Edinakova <gedinakova@infragistics.com>
| <code-view style="height:700px" | ||
| no-theming | ||
| data-demos-base-url="{environment:demosBaseUrl}" | ||
| iframe-src="{environment:demosBaseUrl}/interactions/query-builder-request-sample" > |
There was a problem hiding this comment.
While this sample can remain here to explain how the customer uses the api to make these requests, the "request sample" should be the main sample in the main topic, instead of the one simply listing the query as text.
There was a problem hiding this comment.
Basically as a showcase for the QB. The main topic doesn't have to provide any additional explanation to what the sample is about.
| @@ -0,0 +1,233 @@ | |||
| --- | |||
| title: Using Query Builder Model | |||
| _description: Angular Query Builder provides easily serializable/deserializable JSON format model, making it easy to build SQL queries. Try it Now. | |||
There was a problem hiding this comment.
| _description: Angular Query Builder provides easily serializable/deserializable JSON format model, making it easy to build SQL queries. Try it Now. | |
| _description: Angular Query Builder provides an easily serializable/deserializable JSON format model, making it easy to build SQL queries. Try it now. |
| --- | ||
|
|
||
| # Using Query Builder Model | ||
| Angular Query Builder provides serializable/deserializable JSON format model, making it easy to build SQL queries. |
There was a problem hiding this comment.
| Angular Query Builder provides serializable/deserializable JSON format model, making it easy to build SQL queries. | |
| Angular Query Builder provides an easily serializable/deserializable JSON format model, making it easy to build SQL queries. |
| @@ -0,0 +1,233 @@ | |||
| --- | |||
| title: Using Query Builder Model | |||
There was a problem hiding this comment.
| title: Using Query Builder Model | |
| title: Using the Query Builder Model |
| _keywords: Angular Query Builder component, Angular Query Builder control, Ignite UI for Angular, UI controls, Angular widgets, web widgets, UI widgets, Angular, Native Angular Components Suite, Angular UI Components, Native Angular Components Library | ||
| --- | ||
|
|
||
| # Using Query Builder Model |
There was a problem hiding this comment.
| # Using Query Builder Model | |
| # Using the Query Builder Model |
| > [!Note] | ||
| > A subquery is a query nested inside another query used to retrieve data that will be used as a condition for the outer query. | ||
|
|
||
| Selecting the *IN / NOT-IN* operator in a `FilteringExpression` would create a subquery. After choosing entity and a column to return, it checks if the value in the specified column in the outer query matches or not any of the values returned by the subquery. |
There was a problem hiding this comment.
| Selecting the *IN / NOT-IN* operator in a `FilteringExpression` would create a subquery. After choosing entity and a column to return, it checks if the value in the specified column in the outer query matches or not any of the values returned by the subquery. | |
| Selecting the *IN / NOT-IN* operator in a `FilteringExpression` would create a subquery. After choosing an entity and a column to return, it checks if the value in the specified column in the outer query matches any of the values returned by the subquery. |
|
|
||
| ## SQL Example | ||
|
|
||
| Let's take a look at a practical example how the Ignite UI for Angular Query Builder Component can be used to build SQL queries. |
There was a problem hiding this comment.
| Let's take a look at a practical example how the Ignite UI for Angular Query Builder Component can be used to build SQL queries. | |
| Let's take a look at a practical example of how the Ignite UI for Angular Query Builder Component can be used to build SQL queries. |
|
|
||
| In the sample below we have 3 `entities` with names 'Suppliers', 'Categories' and 'Products'. | ||
|
|
||
| Let's say we want to find all suppliers who supply products that belong to the 'Beverages' category. Since the data is distributed across all entities we can take advantage of the *IN* operator and accomplish the task by creating subqueries. Each subquery is represented by a `FilteringExpressionsTree` and can be converted to a SQL query through the `transformExpressionTreeToSqlQuery(tree: IExpressionTree)` method. |
There was a problem hiding this comment.
| Let's say we want to find all suppliers who supply products that belong to the 'Beverages' category. Since the data is distributed across all entities we can take advantage of the *IN* operator and accomplish the task by creating subqueries. Each subquery is represented by a `FilteringExpressionsTree` and can be converted to a SQL query through the `transformExpressionTreeToSqlQuery(tree: IExpressionTree)` method. | |
| Let's say we want to find all suppliers who supply products which belong to the 'Beverages' category. Since the data is distributed across all entities, we can take advantage of the *IN* operator and accomplish the task by creating subqueries. Each subquery is represented by a `FilteringExpressionsTree` and can be converted to SQL through the `transformExpressionTreeToSqlQuery(tree: IExpressionTree)` method. |
| ) | ||
| ``` | ||
|
|
||
| Now we can set the `expressionsTree` property of the `IgxQueryBuilderComponent` to `suppliersTree`. Furthermore, every change to the query triggers a new request to the endpoint and the results data shown in the grid is refreshed. |
There was a problem hiding this comment.
| Now we can set the `expressionsTree` property of the `IgxQueryBuilderComponent` to `suppliersTree`. Furthermore, every change to the query triggers a new request to the endpoint and the results data shown in the grid is refreshed. | |
| Now we can set the `expressionsTree` property of the `IgxQueryBuilderComponent` to `suppliersTree`. Furthermore, every change to the query triggers a new request to the endpoint and the resulting data shown in the grid is refreshed. |
Closes #6054
Checklist:
preview\beta../relative/path.mdIgxSelectComponent,<igx-combo>code blocksfor the names of classes / tags / propertiescode blockspending-localizationlabel when the review of the PR is done