Is it possible to exclude null values using RecordedValues method and setting correctly the filter Expression ?
There is a PE function IsBad to returns true if the value is a SYSTEM digital state or NaN. You would use this is your expression with the appropriate Not if needed.
The filter expression passed with the AFData.RecordedValues method must use valid PI Expression syntax. A 'null' value using that syntax would probably be defined as "". I've never seen such a null value stored in the data archive, so I would expect that such a filter expression would not filter anything. If your definition of a null value is actually something like 0 (zero) then yes you could exclude such values using an appropriate filter expression passed with RecordedValues.
AFValues for PI tags coming from the data archive will not be null, nor will their Value property be null. Note too that somewhere around 2012, the data archive does not allow floating point NaN to be written. Any attempt to do so will write a digital state of 317 (Invalid_Float).
Can you elaborate more about where the nulls are coming from?
myNull value, I should say NoData,
is a record with a time, a null value and a status -248, created thru PI Web API digital state 248 (as issystem=true)
For example a common case is a current value of 248 corresponding to "No Data."
Effectively using the filter Badval('.') = 0
It retrieves only the valid data
Retrieving data ...