How to handle null value in expression?
What do you mean?
normaly in the database having a value - null = null
and if you do aggregation (Sum), the end result will be null.
If you don't want this behaviour, I think you may have the following options:
1- use a default value in the database and don't use null in the field you want to have arithmatic operations upon.
2- execlude the null rows by using a Filter.
3- Use a CASE statement to replace (value - null = null) by a value maybe 0, in order not to ruin your Sum operation. You can do this by implementing IExpression as shown in the following thread
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3829
Or you might implement all your query in a database view and map it to an Entity or a TypedView.