I’m having a foreach loop in my web application. I need to use this loop in crystal report’s formula field. I’m new to crystal reports and I have no idea with how to write it in formula field. Can anyone help me?
foreach (DataRow dr in ds.Tables[0].Rows)
{
type = (dr["color"]).ToString();
if (color == "red")
{
red_total = red_total + Convert.ToDouble(dr["amount"]);
}
else if (color == "blue")
{
bl_total = bl_total + Convert.ToDouble(dr["amount"]);
}
}
create two formula fields:
Add a crosstab to your report.
Add these two fields to the summary section (lower right).
Add row and column grouping, if desired.
Alternate:
Add these two fields to Details section
Add a summary for each of these fields.