In a section report, expressions can be used in the DataField property to specify textbox output in a report, such as date/time, mathematical calculations or conditional values. All field expressions used in the DataField property begin with the equals sign (=).
Set the DataField property of a textbox control to a mathematical calculation.
Example:
=UnitPrice+5
=Quantity-5
=Quantity*UnitPrice
=UnitPrice/QuantityPerUnit
Set the DataField property of a textbox control to the required substring. While setting up grouping, change the GroupHeader's DataField property to the same substring.
Example:
=ProductName.Substring(0, 1)
Set the DataField property of a textbox control similar to the following expression to display date/time values.
Example:
=System.DateTime.Now.ToString()
Set the DataField property of a textbox control to the conditional statement as desired.
Example:
=(UnitsInStock > 0)?"In Stock":"Backorder"
Set the DataField property of a textbox control similar to the following expression to display concatenated fields.
Example:
="There are " + UnitsInStock + " units of " + ProductName + " in stock."
=TitleOfCourtesy + " " + FirstName + " " + LastName
Set the DataField Property of a textbox control like the following example.
Example:
=(double)System.Math.Round(UnitsInStock/10)
Set the DataField property of a textbox control like the following example to get the remainder (2 in this case).
Example: =22%(5)
Set the DataField property of a textbox control like the following example to replace null with your own value.
Example:
=(UnitsInStock == System.DBNull.Value) ? "No Units In Stock" : UnitsInStock