Parameters

 


A user is normally interested in economic activity data over a specific period. This is why almost any report includes parameters that specify the beginning and the end of the report period.

Report parameters specify the conditions for including records in the report. In the data composition schema you can define report parameters on the Parameters tab (fig. 13.29).

 
Fig. 13.29. Data composition parameters

The tab contains three parameters: BeginOfPeriod, EndOfPeriod, and MaterialServiceType. You might ask why you have three parameters here while you only specified one (MaterialServiceType) in the query.

The data composition system analyses query text on its own and in addition to the explicitly specified parameters (MaterialServiceType) provides the option to customize parameters of virtual tables that participate in the query.

This is the case for the BeginOfPeriod and EndOfPeriod parameters. They are the two first parameters of the AccumulationRegister.Sales.Turnovers virtual table, which is used in the query, in the left join.

If you select this table in the list of tables in the Query builder and then click the Virtual table parameters  button, a dialog box with the BeginOfPeriod and EndOfPeriod parameters is displayed (fig. 13.30).


Fig. 13.30. Virtual table parameters

The first parameter stores the beginning of the totals calculation period, while the second parameter stores the end of the period. So the source table contains only turnovers calculated for the specified period.

Remember that when you pass a date to any of these parameters (it is what you will do later in this example), the date includes time with a one-second precision.

Suppose that you know in advance that the user does not need the report results for periods specified in seconds. Then you have to do the following two things.

First, eliminate the need to enter time when a user enters report period dates. To implement this, let us modify the type definition for the BeginOfPeriod parameter.

  1. In the Data composition schema wizard, click the Parameters tab.
  2. For the BeginOfPeriod parameter, double-click in the Type cell.
  3. Click the Select  button and then, in the Date format list, select Date.
  4. Click OK (fig. 13.31).


    Fig. 13.31. Editing date format

Second, the default time value in a date is 00:00:00. If a user specifies a report period from 6/1/2014 to 6/11/2014, the register totals are calculated from the beginning of the day 6/1/2014 00:00:00 to the beginning of the day 6/11/2014 00:00:00. The data for the 11th day of the month that is not available at the beginning of the day is not included in the report, which might confuse users.

To eliminate this issue, let us add a new EndDate parameter for storing the end date entered by the user. And let us set up automatic calculation of the EndOfPeriod parameter, so that it points to the end of the day specified by the user.

  1. For the EndOfPeriod parameter, select the Availability restriction check box (fig. 13.32).


    Fig. 13.32. Adding the EndDate parameter

    When the check box is cleared, the parameter is available for user customization. And when the check box is selected, the parameter is hidden from the user interface.
  2. Click the Add  button in the command bar and add the EndDate parameter.

    The platform automatically generates the End date title for this parameter.
  3. For the EndDate parameter, set the type to Date, and then set Date format to Date, just like you did for the BeginOfPeriod parameter.
  4. For the BeginOfPeriod parameter, set the title to Beginning date.

    Note that by default the added parameter is available to users (the Availability restriction check box is cleared). This is fine with us.

    Then let us look at the EndOfPeriod parameter. You have selected its Availability restriction check box because you will implement the calculation of the parameter value based on the EndDate parameter value entered by the user.

    Let us use the expression language of the data composition system for specifying the EndOfPeriod calculation formula. This language includes the EndOfPeriod() function, which gets a date that corresponds to the end of some period, for example, the end of the specified day.
  5. For the EndOfPeriod parameter, in the Expression cell, type the expression shown in listing 13.9.

    Listing 13.9. Expression for calculating the EndOfPeriod parameter value

    EndOfPeriod(&EndDate,"Day")
    Note. The expression language available in the data composition system is described in detail in the built-in help in Designer.

    To open the built-in help

    1. On the Help menu, click Help contents.
    2. In the help contents, open section 1C:EnterpriseData Composition System / Data Composition System Expression Language.
    Once you are done with these steps, the composition parameters should look as shown in fig. 13.33.

    Fig. 13.33. Composition system parameters

    Finally, let us set up the MaterialServiceType parameter.

    Since the report should display the revenue generated by sales of services only, the value of the MaterialServiceType parameter should not be edited by users. It should be specified directly in the composition schema as Enumeration.MaterialServiceType.Service.

    For the MaterialServiceType parameter, the Availability restriction check box is selected by default, so you only need to specify the required value of the MaterialServiceTypes enumeration in the Value cell.
  6. For the MaterialServiceType parameter, in the Value cell, click the Select button and select Service (fig. 13.34).


    Fig. 13.34. Specifying MaterialServiceType parameter value

Comments
0
Add comment