Forum Discussion

marcobobbiesi's avatar
marcobobbiesi
New Contributor III
2 years ago

IsValid Destination / IsDesinationWithin the constrain / DataBuffer Log for errors

Hi guys

we frequently work with data buffer (or sometimes even with setcell) and there's a problem for which I coudn't find a solution. E.g. we have an allocation setting the values to certain intersections in the target data buffer. If among all cells to write some of them are invalid intersection (not within the constraints of the account for one or more Flow/Ud element), there's no error and they are simply not written. From here: is there a function to test an intersection and check whether it's valid or not? Is there a function to do that for the whole databuffer without loops and get the list of invalid records?

Even worse, sometimes the target members don't exist and we just get an error. But I need to log the data buffer and investigate each single row to identify where the problem is. Is there a function or a best practice to get a log with the rows in error in case the target members don't exist?

We found this function(s) api.Account.IsFlowICOrUDMemberWithinConstraintMember(accountMemberId, flowICOrUDDimPk, flowICOrUDMemberId, varyByCubeTypeId), but this works for a dimension at a time, not very efficient.

Thanks a lot for sharing great ideas!

Marco

  • ChristianW's avatar
    ChristianW
    Valued Contributor

    I wasn't investigating it, but did you try:

    Dim myCell As DataBufferCell
    myCell.CellStatus.Invalid

     

    • marcobobbiesi's avatar
      marcobobbiesi
      New Contributor III

      Hi Christian,

      thank you for the hint... but apparently this does not work.

      'Here I define a target cell, replacing the soure account with the plug, where the target flow is not valid. Then I used CellStatus.Invalid to determine the whether the target cell is valid (which is not).

      Dim targetcell As New DataBufferCell(cell)
      targetcell.SetAccount(api, PlugAcc)
      api.LogMessage(" OK1 invalid " & cell.CellStatus.Invalid & " " & cell.DataBufferCellPk.GetMemberScript(api) )
      api.LogMessage(" Ko1 invalid " & targetcell.CellStatus.Invalid & " " & targetcell.DataBufferCellPk.GetMemberScript(api) )

      'This is what OS prints, both seem to be valid (Invalid = FALSE)
      OK1 invalid False A#23411021:F#F015:O#Import:I#VAAG:U1#GBBAHNOTHER:U2#Package:U3#AUT:....
      Ko1 invalid False A#21558311:F#F015:O#Import:I#VAAG:U1#GBBAHNOTHER:U2#Package:U3#AUT ....


      'But if I actually check wether the flow is within the contraint, OS correctly highlights it's not. Of course, doing something like that for all dimension would not be very efficient, considering that i want to log this during a consolidation / allocation process

      Dim tCellFlowValid As Boolean = api.Account.IsFlowICOrUDMemberWithinConstraintMember(targetcell.DataBufferCellPk.AccountId, BRApi.Finance.Dim.GetDimPk(si, "cFlow"), targetcell.DataBufferCellPk.FlowId )
      Dim sCellFlowValid As Boolean = api.Account.IsFlowICOrUDMemberWithinConstraintMember(cell.DataBufferCellPk.AccountId, BRApi.Finance.Dim.GetDimPk(si, "cFlow"), cell.DataBufferCellPk.FlowId )
      api.LogMessage("Flow Valid Source: " & sCellFlowValid & " FlowValid Dest: " & tCellFlowValid)

      'PRINTED:
      Flow Valid Source: True FlowValid Dest: False


      Do you believe I did something wrong or this "Cellstatus.invalid" thing is meant for something else?