如何在Crystal报表的公式字段中使用循环 [英] How to use loops in formula field on a crystal report

查看:153
本文介绍了如何在Crystal报表的公式字段中使用循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查表中的所有记录.我的Web应用程序中有一个foreach循环.我需要在Crystal Report的公式字段中使用此循环.我是Crystal报表的新手,我不知道如何在公式字段中编写它.谁能帮我吗?

  foreach (在ds.Tables [" ]).ToString();
    如果(类型== "  )
    {
        c_total = c_total + Convert.ToDouble(dr [" ]));
    }
    其他 如果(类型== "  d")
    {
        d_total = d_total + Convert.ToDouble(dr [" ]));
    }
}

解决方案

[ ^ ]可能会给您一个想法.

http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=942 [ ^ ]可能也有帮助.

I need to check all the records in a table.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["type"]).ToString();
    if (type == "c")
    {
        c_total = c_total + Convert.ToDouble(dr["amount"]);
    }
    else if (type == "d")
    {
        d_total = d_total + Convert.ToDouble(dr["amount"]);
    }
}

解决方案

This[^] might give you an idea.

http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=942[^] might also help.


这篇关于如何在Crystal报表的公式字段中使用循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆