09-05-2024 04:21 PM - edited 09-05-2024 04:28 PM
Hi Guys,
We got a request from user to get data from 2023M12 from actual scenario to forecast scenario.
for Balace sheet accounts, the value from 2023M12 to be same till 2024M12 for specific account.
Can anyone help me to find way to retain same value for BS account, i have tried but due to activity calculation and endbalance input value, the value become zero for all the months.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
If Not api.Entity.HasChildren() AndAlso (api.Cons.IsLocalCurrencyForEntity()) Then
Api.Data.Calculate("S#FCST_6_6_Test_Same_value:A#121010:V#YTD:T#2024M1:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#2023M12:O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None")
End If
If Not api.Entity.HasChildren() AndAlso (api.Cons.IsLocalCurrencyForEntity()) Then
Api.Data.Calculate("S#FCST_6_6_Test_Same_value:A#121010:V#YTD:T#2024M1:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#2023M12:O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None")
End If
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Solved! Go to Solution.
a month ago
Hi Eric,
Appreciated for your help, but this code not giving the output what we needed. also i tried with simple code to get last year number to this year. Finally i got the expected value in all the period.
Dim curTimeId As Integer = api.Pov.Time.MemberId
Dim lastPerPYId As Integer = api.Time.GetLastPeriodInPriorYear(curTimeId)
Dim lastPerPY As String = api.Time.GetNameFromId(lastPerPYId)
Dim curYear As String = api.Time.GetNameFromId(api.Time.GetYearFromId(curTimeId))
If (Not api.Entity.HasChildren()) Then 'AndAlso api.Cons.IsLocalCurrencyForEntity() AndAlso api.pov.Scenario.Name.XFEqualsIgnoreCase("FCST_6_6_Test_Same_value") AndAlso curYear.XFEqualsIgnoreCase("2024") Then
' No need to redeclare lastPerPY here, reuse it
lastPerPY = api.Time.GetNameFromId(lastPerPYId)
Api.Data.Calculate("A#121010:V#YTD:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U7#GL_Load:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#" & lastPerPY & ":O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U7#Top:U8#None")
End If
09-06-2024 08:41 AM
This is untested, but should get you what you need:
Dim curTimeId As Integer = api.Pov.Time.MemberId
Dim lastPerPYId As Integer = api.Time.GetLastPeriodInPriorYear(curTimeId)
Dim lastPerPY As String = api.Time.GetNameFromId(lastPerPYId)
Dim curYear As String = api.Time.GetNameFromId(api.Time.GetYearFromId(curTimeId))
If (Not api.Entity.HasChildren()) AndAlso api.Cons.IsLocalCurrencyForEntity() AndAlso api.pov.Scenario.Name.XFEqualsIgnoreCase("FCST_6_6_Test_Same_value") AndAlso curYear.XFEqualsIgnoreCase("2024") Then
Api.Data.Calculate("A#121010:V#YTD:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#" & lastPerPY & ":O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None")
End If
a month ago
Hi Eric,
Appreciated for your help, but this code not giving the output what we needed. also i tried with simple code to get last year number to this year. Finally i got the expected value in all the period.
Dim curTimeId As Integer = api.Pov.Time.MemberId
Dim lastPerPYId As Integer = api.Time.GetLastPeriodInPriorYear(curTimeId)
Dim lastPerPY As String = api.Time.GetNameFromId(lastPerPYId)
Dim curYear As String = api.Time.GetNameFromId(api.Time.GetYearFromId(curTimeId))
If (Not api.Entity.HasChildren()) Then 'AndAlso api.Cons.IsLocalCurrencyForEntity() AndAlso api.pov.Scenario.Name.XFEqualsIgnoreCase("FCST_6_6_Test_Same_value") AndAlso curYear.XFEqualsIgnoreCase("2024") Then
' No need to redeclare lastPerPY here, reuse it
lastPerPY = api.Time.GetNameFromId(lastPerPYId)
Api.Data.Calculate("A#121010:V#YTD:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U7#GL_Load:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#" & lastPerPY & ":O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U7#Top:U8#None")
End If