06-04-2021 06:40 AM - last edited on 05-10-2023 05:04 AM by JackLacava
Hello:
I want to have a confirmation rule write a value to a single intersection (api.data.calculate) by either calling a finance business rule or writing the calculate directly into rule text. The rule loops thru base entities and certain accounts, then writes the value stored there to a single member; basically, a check to ensure that all base members foot to the top of a hierarchy in USD (We have had issues with this in the past, and now have historical data that doesn't foot in certain areas identified in our most recent conversion.)
I don't want this to run on a member formula as it will significantly slow down consolidation on all other data units, and this really is a confirmation by nature; a data quality check. Our consultants suspect that this may be by design; that during the running of confirmation rule, the cube can't get written to.
PS - I can confirm the data calculate is in fact running as I'm writing the calc string to the error log; also that the intersection I'm writing to is in fact open for writing.
Let me know your thoughts and thank you:
James Kirkby
10-18-2021 08:29 AM - edited 10-21-2021 07:38 AM
Did your consultants try to use:
Dim dataCellExs as new list(of DataCellEx)
...
brapi.finance.Data.SetDataCellsUsingMemberScript(si, MemberScriptAndValueList)
This simulates a manual input, you can only write to o#forms (not to o#import).
10-21-2021 07:37 AM - edited 05-10-2022 02:39 AM
Ok, I did some test and it works, but it throws an error message and prevents the confirmation rule from succeeding:
But you can catch the error using the try keyword, here is the code I used for the test:
Try
Dim oneMemberSriptAndValue As New MemberScriptAndValue("Houston", "Cb#GolfStream:E#[South Houston]:C#Local:S#Actual:T#2022M3:V#YTD:A#Headcount:F#NewHires:O#Forms:I#None:U1#MatMgt:U2#None:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None", 99999, False, "")
Dim MemberScriptAndValueList As New List(Of MemberScriptAndValue)
MemberScriptAndValueList.Add(oneMemberSriptAndValue)
brapi.finance.Data.SetDataCellsUsingMemberScript(si, MemberScriptAndValueList)
Catch ex As Exception
'Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
args.ConfirmationRuleArgs.DisplayValue = api.Data.GetDataCell("A#Headcount:U1#MFG:U2#Top:U3#Top:U4#Top:O#Top").cellAmount
If args.ConfirmationRuleArgs.DisplayValue = 0 Then
Return False
Else
Return True
End If
Hope this helps