Using macros in a report
The Macros tab is available when you select Period as the parameter object in order to specify period parameters for a report.
Macros are used as place holders for data that is dynamic. The data retrieved will change relative to the current date or time. For example, if the current month is JULY 2013, setting a reporting period of JUNE 2013 will retrieve data for the last month. But what if you want to re-use the same report each month to report on the previous month?
Rather than specifying a different month each time, a LAST MONTH macro can be selected to ensure that data is always retrieved for the month prior to the current month.
Because macros define a variable period, they can be included in queries where the report is scheduled to be run periodically. Scheduling a report that summarises details that occurred yesterday, for example, would be impossible to achieve without a macro, as the definition of 'yesterday' varies daily.
Some macros are customisable per site. The definition of LAST PROD WEEK, the period of the last production week, for example, will vary from site to site. The customisation of macros can be provided by Micromine Australia Pty Ltd as a consulting service.
Deleted
When the Deleted check box is selected, data tokens in the (Available Values) selection list that have been deleted from the reference data will be listed alongside active data tokens.
Filter Enabled
Use the Filter check box to set dependencies between the values you select for a report.
For example:
You are running an Equipment Measures by Location report: A particular Source (Location 1) is selected and you want to select an equipment unit.
If the Filter check box is selected, the Available Values list in the Equipment/Unit tab will show only those equipment units with a Source = Location 1.
Macros and how they are defined
The table below provides information about the time periods that can be defined by a macro.
Macro | Start Date | Start Time | End Time | End Date |
---|---|---|---|---|
CURRENT SHIFT | Today's date | Start time of current shift | Time report was run | Today's date |
LAST 120 Days | 119 days ago | 0:00:00 | Time report was run | Today's date |
LAST 14 Days | 13 days ago | 0:00:00 | Time report was run | Today's date |
LAST 30 Days | 29 days ago | 0:00:00 | Time report was run | Today's date |
LAST 60 Days | 59 days ago | 0:00:00 | Time report was run | Today's date |
LAST 7 Days | 6 days ago | 0:00:00 | Time report was run | Today's date |
LAST 90 Days | 89 days ago | 0:00:00 | Time report was run | Today's date |
LAST MONTH | First day of previous Month | 0:00:00 | 24:00:00 | Last day of previous month |
LAST PERIOD | First day of a Targets-defined period, prior to the current period | 0:00:00 | 24:00:00 | Period end date |
LAST WEEK | First day of previous week | 0:00:00 | 24:00:00 | Last day of previous week |
LAST WEEK (Day) | First day of previous week | Accumulated time periods over the Day shifts. | ||
LAST WEEK (Night) | First day of previous week | Accumulated time periods over the Night shifts. | ||
THIS MONTH | First day of this month | 0:00:00 | Time report was run | Today's date |
THIS PERIOD | First day of a Targets-defined period, | 0:00:00 | Time report was run | Today's date |
THIS PROD WEEK | First day of Production week (defined) | 0:00:00 | Time report was run | Today's date |
THIS WEEK | First day of week | 0:00:00 | Time report was run | Today's date |
THIS WEEK (Day) | First day of week | Accumulated time periods over the Day shifts. | ||
THIS WEEK (Night) | First day of week | Accumulated time periods over the Night shifts. | ||
TODAY | Today's date | 0:00:00 | Time report was run | Today's date |
TODAY (Day) | Today's date | Start of Day Shift | Accumulated time over the Day shift. | |
TODAY (Night) | Today's date | Start of Night Shift | Accumulated time over the Night shift. | |
YESTERDAY | Yesterday's date | 0:00:00 | 24:00:00 | Yesterday's date |
YESTERDAY (Day) | Yesterday's date | Start of Day Shift | Accumulated time over the Day shift. | |
YESTERDAY (Night) | Yesterday's date | Start of Night Shift | Accumulated time over the Night shift. |
Notes:
- CURRENT SHIFT. The period of the current shift as defined in Reference Data.
- THIS PERIOD/ LAST PERIOD. Custom-defined PERIODS are defined in the Targets service.
- LAST <XX> DAYS are inclusive of the day of submission. So if you run a report today for the LAST 7 Days you only get 6 days + whatever has transpired so far today. This behaviour is configurable however.
-
THIS WEEK, LAST WEEK. A week is usually defined as Sunday to Saturday, although this may vary from site to site.
- (Day) and (Night). The time periods for Day and Night shifts are defined in Reference Edit.
-
LAST PROD WEEK and THIS PROD WEEK. These macros depend upon on the site definition of a Production Week, which is typically defined as starting on Sunday and ending on Saturday. Some sites may define Monday to Sunday as the Production Week, however.
Contact your Pitram Administrator if you need to modify the PRODUCTION WEEK setting.
Summary fields
If a macro has been used to specify the period, you can still use a (Year, Month, Day, Shift) period as the summary level in a report. However, an additional "Macros" option allows you to summarise your data for the period specified by the macro.
Advanced Job Options
When distributing reports using the Email, Library and Disk Advanced job options, the following macros (enclosed in square brackets) can be included in the Report description or the Job name:
- [NAME] - the name of the report
- [DATE] - the date on which the report was run
- [TIME] - the time at which the report was run
- [AUTHOR] - the user who ran the report