Hi All,
I have written a rule to create a forecast trigger which copies data to the next forecast when the trigger account for the period is populated with a 1. I have then told the trigger account to clear after consolidation.
The issue is that when the trigger account clearing is commented out, the rule copies across fine and when the it is included in the rule, it does not work.
I assume this is a timing issue somehow but can anyone offer me advice on how to include the clearing of the trigger account? Below is my rule:
Sub FcastFcastMap(xvPeriodList)
vIsBaseDataEntryLevel = IsBaseDataEntryLevel()
vIsDataEntryLevel = IsDataEntryLevel()
vEntity = HS.Entity.Member()
vValue = HS.Value.Member()
vTransCur = HS.Value.IsTransCur()
VtriggerAccount = HS.GetCell ("A#T002.E#[None].C1#[None].C2#[None].C3#[None].C4#[None].P#CUR")
Dim vGlobalRate
Dim vGlobalRateList
For Each vPeriod In xvPeriodList
If HS.Period.Member() = vPeriod Then
If vEntity = "[None]" And vValue = "[None]" Then
If vtriggerAccount = 1 Then
vGlobalRatesList = HS.Account.List("ExRate","[Base]")
For each vGlobalRate in vGlobalRatesList
HS.Clear "A#" & vGlobalRate
HS.Exp "A#" & vGlobalRate &" = A#" & vGlobalRate & ".S#"&PrevForecastScenario&".P#" & vPeriod
Next 'end of global exchange rates list
End if ' trigger account
End If 'end of entity none - value = none condition
'Run at data entry level to include intercompany impact
If vValue = "<Entity Currency>" Then
If vtriggerAccount = 1 Then
'Map P Loss Accts
vActualAcctList = HS.Account.List("PLoss","[Base]")
For Each vActualAcct In vActualAcctList
vFcastAcctMap = vActualAcct
'Clear Forecast mapped accounts before running mapping calculation
HS.Clear "A#" & vFcastAcctMap
HS.Exp "A#" & vFcastAcctMap & ".C3#LocalRep" &"= A#" & vFcastAcctMap & ".C3#GrpRptTot" & ".S#"&PrevForecastScenario&".V#<Entity Curr Total>.P#" & vPeriod
Next 'end of actual accounts mapped loop
End If
If vtriggerAccount = 1 Then
'Map Bal Sheet Accts
vActualAcctList = HS.Account.List("BalSheet","[Base]")
For Each vActualAcct In vActualAcctList
vFcastAcctMap = vActualAcct
'Clear Forecast mapped accounts before running mapping calculation
HS.Clear "A#" & vFcastAcctMap
HS.Exp "A#" & vFcastAcctMap & ".C3#LocalRep" &"= A#" & vFcastAcctMap & ".C3#GrpRptTot" & ".S#"&PrevForecastScenario&".V#<Entity Curr Total>.P#" & vPeriod
Next 'end of actual accounts mapped loop
End If
If vtriggerAccount = 1 Then
'Map Metric Accts
vActualAcctList = HS.Account.List("SuppData","[Base]")
For Each vActualAcct In vActualAcctList
vFcastAcctMap = vActualAcct
'Clear Forecast mapped accounts before running mapping calculation
HS.Clear "A#" & vFcastAcctMap
HS.Exp "A#" & vFcastAcctMap & ".C3#LocalRep" &"= A#" & vFcastAcctMap & ".C3#GrpRptTot" & ".S#"&PrevForecastScenario&".V#<Entity Curr Total>.P#" & vPeriod
Next 'end of actual accounts mapped loop
End if
If vtriggerAccount = 1 Then
'Map Metric Accts
vActualAcctList = HS.Account.List("Metrics","[Base]")
For Each vActualAcct In vActualAcctList
vFcastAcctMap = vActualAcct
'Clear Forecast mapped accounts before running mapping calculation
HS.Clear "A#" & vFcastAcctMap
HS.Exp "A#" & vFcastAcctMap & ".C3#LocalRep" &"= A#" & vFcastAcctMap & ".C3#GrpRptTot" & ".S#"&PrevForecastScenario&".V#<Entity Curr Total>.P#" & vPeriod
Next 'end of actual accounts mapped loop
End if
End if
End If
Next
HS.Clear "A#T002.C1#[None].C2#[None].C3#[None].C4#[None]"
Thank you,
Emma