EVALEXPRESSION





This function returns an expression for recording a specified grouping. This function has the following parameters:

  • Calculated expression. A string that contains an expression to be calculated.
  • Grouping. A string that contains a name of a grouping where an expression is calculated. If the parameter value is a blank string, the calculation is performed in the context of the current grouping. If the parameter value is Overall, the calculation is performed in the context of the grand total. If the calculation is performed in a table and the parameter value is a name of a row grouping or a blank string, the calculation is performed for the grouping formed by the intersection of the calculation area (see the third parameter description) and the current row of the column grouping. If the parameter value is a column grouping name, the calculation is performed for the grouping formed by the intersection of the column grouping calculation area and the current row grouping record.
  • Calculation area. A string that contains a calculation area. If the parameter value is a blank string, the calculation is performed for the current record of the grouping specified in the first parameter. If the parameter value is Overall, the expression is calculated for the overall of the grouping specified in the second parameter. 

If the parameter value is Group, values are calculated for the current group record of the grouping.

If the parameter value is NonResourceGroup, an expression is calculated for the first group record of the original grouping when calculating the function for a group record by resources.

When calculating the EvaluateExpression function with the NonResourceGroup value for group records that are not grouped by resources, the function is calculated in the same way as if with the Group parameter value.
When the data composition template composer generates a data composition template, it outputs an expression calculated using the EvaluateExpression function with the specified NonResourceGroup parameter as a grouping resource field. For other grouping resources, it outputs standard resource expressions.

If the parameter contains the Hierarchy string, the expression is calculated for the parent hierarchical record, if it exists, or for the whole group, if such a record does not exist. When generating an expression for the % in hierarchy group field, the template composer generates an expression that contains a ratio between the resource expression and the EvaluateExpression function for the resource expression calculated for the current grouping with the Hierarchy calculation type.

  • Start. Specifies the first record of a fragment where the aggregate functions of the expression are calculated and the record for retrieving field values outside aggregate functions. A string that contains one of the following:
  • First. Get the first grouping record. The expression whose result will define the shift from the beginning of the grouping may be specified in parentheses after this word. The resulting value must be a positive integer. For example, with First(3) the third record from the beginning of the grouping is retrieved.
    If the first record is beyond the grouping, it is considered that there are no records. For example, if there are 3 records and
    First(4) is specified, it is considered that there are no records.
  • Last. Get the last grouping record. The expression whose result will define the shift from the end of the grouping may be specified in parentheses after this word. The resulting value must be a positive integer. For example, with Last(3) the third record from the end of the grouping is retrieved.
    If the last record is beyond the grouping, it is considered that there are no records. For example, if there are 3 records and
    Last(4) is specified, it is considered that there are no records.
  • Previous. Get the previous grouping record. The expression whose result will define the shift back from the current grouping record may be specified in parentheses after this word. For example, with Previous(2) the previous from the previous record is retrieved.
    If the previous record is beyond the grouping (for example, you get Previous(3) for the second record of the grouping), the result is the first grouping record.
    If the previous record is retrieved for a grouping total, the result is the first record.
  • Next. Get the next grouping record. The expression whose result will define the shift forward from the current grouping record may be specified in parentheses after this word. For example, with Next(2) the next from the next record is retrieved.

    If the next record is beyond the grouping, it is considered that there are no records. For example, if there are 3 records and Next is specified for the third record, it is considered that there are no records.

    If the next record is retrieved for a grouping total, it is considered that there are no records.

  • Current. Get the current record.
    If a record is retrieved for a grouping total, the result is the first record.
  • BoundaryValue. Get a record by the specified value. The BoundaryValue keyword must be followed by an expression of the first order field that begins the fragment, in parentheses.
    The first record with an order field value greater than or equal to the specified value is retrieved. For example, if the Period field is used as an order field, this field has the values 01/01/2010, 02/01/2010, and 03/01/2010, and you get BoundaryValue(DateTime(2010, 1, 15)), a record with the date 02/01/2010 is retrieved.
  • End. Specifies the last record of a fragment where the aggregate functions are calculated. A string that contains one of the following:
  • First. Get the first grouping record. The expression whose result will define the shift from the beginning of the grouping may be specified in parentheses after this word. The resulting value must be a positive integer. For example, with First(3) the third record from the beginning of the grouping is retrieved.
    If the first record is beyond the grouping, it is considered that there are no records. For example, if there are 3 records and First(4) is specified, it is considered that there are no records.
  • Last. Get the last grouping record. The expression whose result will define the shift from the end of the grouping may be specified in parentheses after this word. The resulting value must be a positive integer. For example, with Last(3) the third record from the end of the grouping is retrieved.
    If the last record is beyond the grouping, it is considered that there are no records. For example, if there are 3 records and Last(4) is specified, it is considered that there are no records.
  • Previous. Get the previous grouping record. The expression whose result will define the shift back from the current grouping record may be specified in parentheses after this word. For example, with Previous(2) the previous from the previous record is retrieved.
    If the previous record is beyond the grouping (for example, you get Previous(3) for the second record of the grouping), it is considered that there are no records.
    If the previous record is retrieved for a grouping total, the result is the last record.
  • Next. Get the next grouping record. The expression whose result will define the shift forward from the current grouping record may be specified in parentheses after this word. For example, with Next(2) the next from the next record is retrieved.  
    If the next record is beyond the grouping, the result is the last record. For example, if there are 3 records and Next is specified for the third record, the result is the third record.
    If the next record is retrieved for a grouping total, it is considered that there are no records.
  • Current. Get the current record.
    If a record is retrieved for a grouping total, the result is the first record.
  • BoundaryValue. Get a record by the specified value. The BoundaryValue keyword must be followed by an expression of the first order field that begins the fragment, in parentheses.
    The last record with an order field value less than or equal to the specified value is retrieved. For example, if the Period field is used as an order field, this field has the values 01/01/2010, 02/01/2010, and 03/01/2010, and you get BoundaryValue(DateTime(2010, 1, 15)), a record with the date 01/01/2010 is retrieved.
  • Sorting. A string that contains comma-separated expressions to order the sequence by. If no string is specified, the values are ordered similarly to the grouping for which an expression is calculated. Each expression may be followed by the Asc keyword to group in ascending order or the Desc keyword to group in descending order, or Autoorder to order reference fields by fields to order the referenced object by. The Autoorder keyword can be used together with the Asc or Desc keyword.
  • HierarchicalSorting. A string that contains comma-separated expressions to order the sequence by. It is used for ordering hierarchical records. If this parameter is not specified, the records are ordered as described in the Sorting parameter.
  • IdenticalOrderValuesProcessing. A string that contains one of the following:
  • Together. Define the previous and next records based on the order expression values.
  • Separately. Define the previous and next records based on a sequence of ordered records.

For example, a sequence is ordered by date:

1. January 1, 2001 M. Ivanov 10
2. January 2, 2001 S. Petrov 20
3. January 2, 2001 P. Sidorov 30
4. January 3, 2001 S. Petrov 40

If the Separately order option is used to process identical values, record 2 is previous to record 3. If the Together option is used, this would be record 1. With the Separately option, a fragment for the record that is current to record 2 is record 2. With the Together option, it would include records 2 and 3. Therefore, with the Separately option, the sum by the current record would be 20. With the Together option, it would be 50.

If Together is specified in the Start and End parameters, shifts for the First, Last, Previous, and Next positions cannot be specified.

Separately is the default option.


Comments
0
Add comment