Null values saving as zero to Historian

Hi, I have temperature values I'm recording. They should only record when the product hopper has product in them so I created an expression tag "Hopper 1 Temp", the expression looks like this:

if({[.]Hopper 1 Level} > 20, {[.]Hopper 1 Temp (Raw)}, null)

Which works as set up and shows a temperature when the hopper is over 20% and null when it's not. The problem is when null gets stored in historian, it gets stored as 0, so when we print end of day reports it shows the temperature as 0°F which is WAY out of specification. The temperature should be around -25°F to -35°F.

Maybe I'm going about it the wrong way?

The historian has no proper way to turn recording on and off based on another variable. It just isn't designed for such applications.

Use transaction groups in the SQL bridge module, or script your database history for the relevant tags.

Why use null in the first place? We just use a set negative value that is obviously faulted like -255.

Use Absolute Zero!

I just ended up putting logic in the PLC to only update the address Ignition reads when the hopper is more than 20%. So if the last temp read while the hopper is 20% full is -30F it will not report another temperature until 30 seconds after the hopper refills to allow the RTD to adjust. The historian is set for OnChange so it doesn't record null or 0.

I was definitely overthinking this.