Creatio development guide
PDF
This documentation is valid for Creatio version 7.15.0. We recommend using the newest version of Creatio documentation.

DataService. Using macros

Glossary Item Box

General provisions

During execution of DataService operations data often needs to be filtered for a certain period of time. Macros simplify such tasks and help to avoid creating unnecessary custom methods. The macros are implemented in a form of special classes that are designed for calculating typical values in query expressions, such as calculating the start and end date of the current quarter. Macros can be used only if the query expression type is a function. For more information about macro expression types, please see the DataService. Data filtering article.

Types of macros

When creating queries to DataService, both parameterized (ie requiring an argument) and non-parameterized macros can be used. Macro types that must be used in the macro expressions are defined in the EntitySchemaQueryMacrosType enumeration in the Terrasoft.Core.Entities name space. Enumeration values of macro types and their descriptions are available in table 1.

Table 1. Values of the EntitySchemaQueryMacrosType enumeration and their descriptions

Macro Value Description
CurrentHalfYear 16 Current half-year (January-June or July-December).
CurrentHour 21 Current hour.
CurrentMonth 10 Current month.
CurrentQuarter 13 Current quarter.
CurrentUser 1 Current user.
CurrentUserContact 2 Contact record of the current user.
CurrentWeek 7 Current week.
CurrentYear 19 Current year.
DayOfMonth 28 Day of month. Requires parameterization.
DayOfWeek 29 Week day. Requires parameterization.
Hour 30 Hour. Requires parameterization.
HourMinute 31 Time. Requires parameterization.
Month 32 Month. Requires parameterization.
NextHalfYear 17 Next half-year (January-June or July-December).
NextHour 22 Next hour.
NextMonth 11 Next month.
NextNDays 24 Next N days. Requires parameterization.
NextNHours 26 Next N hours. Requires parameterization.
NextQuarter 14 Next quarter.
NextWeek 8 Next week.
NextYear 23 Next year.
None 0 Type of macro not defined.
PreviousHalfYear 15 Previous half-year (January-June or July-December).
PreviousHour 20 Previous hour.
PreviousMonth 9 Previous month.
PreviousNDays 25 Previous N days. Requires parameterization.
PreviousNHours 27 Previous N hours. Requires parameterization.
PreviousQuarter 12 Previous quarter.
PreviousWeek 6 Previous week.
PreviousYear 18 Previous year.
Today 4 Today.
Tomorrow 5 Tomorrow.
Year 33 Year. Requires parameterization.
Yesterday 3 Yesterday.

See Also

© Creatio 2002-2020.

Did you find this information useful?

How can we improve it?