User-Defined Queries (UDQs) are an important part of the analytics functionality of SAP Business One, Web client.
You can create SQL scripted queries (UDQs) in both SAP Business One, Web client and the Desktop client. A UDQ written in either client can be used in both clients. However, update queries or parameter type queries written in the Desktop client will not be visible in the Web client.
When a UDQ is opened in the Web client it is viewed via a list view screen, with all the standard list view functionalities associated with it, such as the table view, chart view, card view, date offset, date aggregation, and view saving functionality.
When a UDQ created in either the Desktop or Web clients is edited in the Web client, you can apply additional settings to it. You can perform the following:
- Change the field names.
- Apply links to fields where appropriate, for example, when data is viewed, choosing the link will open the data source associated with it.
- Change numeric fields, which by default are set to be measure fields, to be treated as dimension fields.
- Set numeric fields totals to, for example, count, sum, average, min, max. This will affect the list view display of table view grid totals and grouping totals.
- Set the rounding display of numeric fields to different rounding options.
UDQ Categories, which also control query authorization access, are currently set up and managed in SAP Business One, Desktop client.
In this video, you’ll learn how to create user-defined queries in SAP Business One, Web client.
Video summary
To create a user-defined query (UDQ) in SAP Business One, Web client,use the User-Defined Queries app.
- For a new query, enter a name and choose a category. Then in the SQL Statement, type the query syntax. While typing, the word prompter appears, with suggested field, tables, and key words for you to choose from. In this example the query statement we typed was:
Select:
T0."DocEntry", T0. "DocNum", T0. "ObjType", T0. "DocTotal",
T0. "CardCode", T0. "CardName", T0. "DocDate", T0. "DocDueDate", T0. "TaxDate"
From OINV T0
SELECT and then the required field names (or star to select all table fields)
FROM to specify the table you want to select the fields from.
Call the table you specified table Zero T0.
- When you complete the SQL Statement and click away, the Columns section populates with the user-defined query information:
- The fields names in the Description column can be edited.
- A field type can be either a dimension or measure. Dimension is a type of a non-numeric field, and it can't be edited. Dimensional fields contain qualitative values, such as names or dates. It is common to group by this field type.
- Measure fields contain quantitative values that you can measure. For numeric fields ,the type can be either Measure or Dimension, but the default type is Measure.
- Measure fields have aggregation methods available for them, and the field values can be rounded to the decimal using a set the decimal places definition.
- You can link a field to another database table. Some fields automatically connected.
- Every user-defined query in the Web client can be presented as a list view in all types: table view, chart view, and a card view. You can add any filters from the list view fields.
You can adjust the available table fields just as in any other list view and you can choose to see more details in columns containing a link.
When setting a UDQ to be active, it will be available to select as data source field for cards on the General Overview and a list view in the Linked List Views app.