The triggers feature is licensed separately from Analytic Services. The following examples are based on the Sample Basic database.
Note: you cannot define a trigger that requires data from dynamic calc members, hybrid analysis members, or members from another partition.
Example 1 tracks the Actual, Sales value for the following month, product, and region:
When the current member being calculated is Jan, and when the Actual, Sales value of Colas for January exceeds 20, the example logs an entry in the file Trigger_jan_Sales.
create or replace trigger Sample.Basic.Trigger_Jan_20
Where
{(Jan,Sales,[100],East,Actual)}
When
Jan > 20 AND Is(Year.CurrentMember, Jan)
then spool Trigger_Jan_20
end;
Example 2 tracks the Actual, Sales value for the following months, product, and region:
When the current member being calculated is Jan, Feb or Mar, and when the Actual, Sales value of Colas for any of the the months January, February, or March exceeds 20, the example logs an entry in the file Trigger_Jan_Sales_20, Trigger_Feb_Sales_20, or Trigger_Mar_Sales_20.
create or replace trigger Sample.Basic.Trigger_Qtr1_Sales
Where
Crossjoin(
{Qtr1.children},
{([Measures].[Sales], [Product].[100], [Market].[East], [Scenario].[Actual])}
)
When
Year.Jan > 20 and is(Year.currentmember, Jan)
then spool Trigger_Jan_Sales_20
When
Year.Feb > 20 and is(Year.currentmember, Feb)
then spool Trigger_Feb_Sales_20
When
Year.Mar > 20 and is(Year.currentmember, Mar)
then spool Trigger_Mar_Sales_20
end;
Example 3 tracks the inventory level for the following product, region, and months:
If the inventory of Colas in the eastern region falls below 500,000, the example trigger sends an email to recipient@company.com.
create or replace trigger Sample.Basic.Inventory_east
where CrossJoin(
{[Qtr1].children},
{([East],[100],[Ending Inventory])}
)
when [Ending Inventory] < 500000 then
mail ([smtp_server.company.com],[sender@company.com],
[recipient@company.com],
[Subject of E-Mail])
end;
| ©2004 Hyperion Solutions Corporation. All Rights Reserved. http://www.hyperion.com |