api.Data.GetDataBufferUsingFormula filter by DataType or StorageType = IsRealData vs IsDerivedData

chris_rothermel
New Contributor III

Is there a way to filter a DataBuffer on DataType or StorageType?

I'm running a business rule in T#2023Q3.  This business rule gets a data buffer for an account.  I was expecting the data to be for just the current period (T#2023Q3) which it does however it also brings quarters Q2 and Q1 which I was not expecting!  I don't want this "IsDerrivedData" brought into my data buffer.  How can I filter it out?

Snag_19cd35b7.png

	'  ƒ WOW! - As we advance the Time we bring in the current and all prior periods.  So 2023Q3 brings in data for Q3 AND Q2 AND Q2!  
	'		Filtering by time doesn't work "RemoveZeros(T#2023Q3:A#A_BSRCarveout:C#None)";  IsDerrivedData, StoredByNoActivity dragged in, why?!?!
	Dim BSRCarveoutDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("RemoveZeros(A#A_BSRCarveout:C#None)")

 

 

2 ACCEPTED SOLUTIONS

chris_rothermel
New Contributor III

Vielen Dank Christian Wetterwald für die schnelle Lösung dieses Problems.

The solution is to simply adjust the View to Periodic and the other Q1 and Q2 data are not brought in.

	Dim BSRCarveoutDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("RemoveZeros(V#Periodic:A#A_BSRCarveout:C#None)")

 

 

View solution in original post

RobbSalzmann
Valued Contributor

Hi @chris_rothermel  if you didn't want to change your View to Periodic, perhaps you can filter on the CellStatus Property of DataBufferCell to get only the data you want:

Dim BSRCarveoutDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("RemoveZeros(A#A_BSRCarveout:C#None)")
'Filter and select DataBufferCells with IsRealData status
Dim realDataCells As Dictionary(Of DataBufferCellPK, DataBufferCell) = BSRCarveoutDataBuffer.DataBufferCells.Where(Function(cell) cell.Value.CellStatus.IsRealData)

 

View solution in original post

5 REPLIES 5

chris_rothermel
New Contributor III

Vielen Dank Christian Wetterwald für die schnelle Lösung dieses Problems.

The solution is to simply adjust the View to Periodic and the other Q1 and Q2 data are not brought in.

	Dim BSRCarveoutDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("RemoveZeros(V#Periodic:A#A_BSRCarveout:C#None)")

 

 

RobbSalzmann
Valued Contributor

Hi @chris_rothermel  if you didn't want to change your View to Periodic, perhaps you can filter on the CellStatus Property of DataBufferCell to get only the data you want:

Dim BSRCarveoutDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("RemoveZeros(A#A_BSRCarveout:C#None)")
'Filter and select DataBufferCells with IsRealData status
Dim realDataCells As Dictionary(Of DataBufferCellPK, DataBufferCell) = BSRCarveoutDataBuffer.DataBufferCells.Where(Function(cell) cell.Value.CellStatus.IsRealData)

 

chris_rothermel
New Contributor III

Hi Robb,

Wow, thank you, that's a great idea!  I took note of your code -- love that 'where' clause example.  

Now in your example 'realDataCells' is of type Dictionary, I wonder how we could bring that back to a 'DataBuffer' type.

RobbSalzmann
Valued Contributor

I think you should be able to reuse the DataBuffer you created ( BSRCarveoutDataBuffer ) and reassign the now filtered DataBufferCells property:

 

 

Dim BSRCarveoutDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("RemoveZeros(A#A_BSRCarveout:C#None)")
'Filter and select DataBufferCells with IsRealData status 
'then reassign as the DataBufferCells property
BSRCarveoutDataBuffer.DataBufferCells = BSRCarveoutDataBuffer.DataBufferCells.Where(Function(cell) cell.Value.CellStatus.IsRealData)

 

 

 

 

chris_rothermel
New Contributor III

Awesome!  Thank you!