| # Initialise workflow You can use a query to set the value of a workflow attribute. A query is used if the value cannot directly be retrieved from an ERP table field. For example you can perform either of the following: You can calculate the total amount of an order You can retrieve information from another table based on the value in an ERP table field. General To create a query Where you can use a query General The query can retrieve: A specific value of an ERP table field (ENtgwms.sqlf.value) The lowest value of an ERP table field (ENtgwms.sqlf.minimum) The highest value of an ERP table field (ENtgwms.sqlf.maximum) The sum of an ERP table field (ENtgwms.sqlf.sum) The average of an ERP table (ENtgwms.sqlf.average) The number of occurrences of an ERP table field (ENtgwms.sqlf.count) Note The text in paranthesis is the Query Function you must use to accomplish the task mentioned. Based on the query field conditions, the range of records is determined that the query will work upon. To create a query To create a new query, you need to start the Queries (tgwms1560m000) session. Click New. Specify a query name and give a short description of its function. Double-click this query and specify the Query Function and the ERP table field name whose value will be used to fill the workflow attribute at run time. Next, specify the query conditions by selecting the Query Field Conditions command on the Specific menu. The total condition (WHERE clause) can consist of individual conditions and are connected by a logical AND. Choose the Check Query Syntax command on the Specific menu to check the syntax of the query. A dialog box shows the error messages. Choose the Evaluate Query command on the Specific menu to test the query (which only works if the Query Syntax is correct). As a result, the query is displayed in a SELECT, FROM, and WHERE format, together with the outcome of the evaluation. If the evaluation is ok you can use the query to set a workflow attribute's value. Where you can use a query A query can be linked to a workflow attribute (binding). To bind a query to a workflow attribute: Start the Business Processes (tgbrg5500m000) session, select a business process, and start the Enterprise Modeler Editor. Right-click an activity and select Insert from the short cut menu and then select Attribute Bindings. Use the Attribute Bindings session to insert new bindings to workflow attributes you have defined for the current business process. |