Apply filter on DFE


#1

Is there a way to use dot filter notation in the include spec of a DFE?

I am trying something like this but it is not working.

@DFE(interval='Day', period='DAY', metric='Quantity', flattenWindows = true, includeSpec='itemHistory.(exists(quantity)).quantity, itemHistory.(exists(quantity)).date')
type ItemQuantityDFE mixes TSDataFlowEvent<MySourceType>

I get an error like this:

Unable to pre-fetch 1 source objects for type MySourceType;
Filtering on fields with an included reference type not supported: quantity

Is there a correct way of doing it?


#2

you can likely use the @DFE(condition=) annotation for this:

@DFE(includeSpec='itemHistory.quantity, itemHistory.date', condition='exists(itemHistory.quantity)')
type ItemQuantityDFE mixes TSDataFlowEvent<MySourceType>

#3

In my case quantity was an ExactDimension. So in order for the filter to work I needed to check if the primitive value existed. See below for working solution.

@DFE(interval='Day', period='DAY', metric='Quantity', flattenWindows = true, includeSpec='itemHistory.(exists(quantity.value)).quantity, itemHistory.date')
type ItemQuantityDFE mixes TSDataFlowEvent<MySourceType>

#4

From Pavan: exists check can only be on primitive/ references( id) not on included types.