Thank You for your reply, but my problem cannot be solved.
SELECT
isNull(QtyReceived, 0) AS 'QtyReceived',
[b]isNull(Qty,0) - isNull(QtyReceived,0)[/b] AS 'QtyBalance'
......
FROM
purchaseOrderTableFields.DefineField(
new EntityField2("QtyBalance", new DBFunctionCall("ISNULL",
new object[] { ([b]PurchaseOrderDetailFields.Qty - PurchaseOrderDetailFields.QtyReceived[/b]), 0 })), 8, "QtyBalance");
IsNull is used for Qty AND QtyReceived.
DbFunctionCall dbFunQty = new DbFunctionCall("ISNULL", new object[] { (PurchaseOrderDetailFields.Qty ), 0 });
EntityField2 eQty = new EntityField2("Qty", dbFunQty);
purchaseOrderTableFields.DefineField(eQty, 6,"Qty");
DbFunctionCall dbFunQtyReceived = new DbFunctionCall("ISNULL", new object[] { (PurchaseOrderDetailFields.QtyReceived), 0 });
EntityField2 eQtyReceived = new EntityField2("QtyReceived", dbFunQtyReceived);
purchaseOrderTableFields.DefineField(eQtyReceived, 7,"QtyReceived");
purchaseOrderTableFields[8].CurrentValue = (decimal)purchaseOrderTableFields[6].CurrentValue - (decimal)purchaseOrderTableFields[7].CurrentValue;
All the CurrentValues are NULL.
How to calc the QtyBalacne, col: [8]?
//===========================
SOLVED!
Otis, do you hv any other soln?
// Add Col:QtyBalance
purchaseOrderTable.Columns.Add("QtyBalance", typeof(decimal)); // col[9]
purchaseOrderTable.Columns[9].Expression = "Qty - QtyReceived";