如何根据年份使用数据填充Crystal Reports [英] How to populate Crystal Reports with data depending on year

查看:82
本文介绍了如何根据年份使用数据填充Crystal Reports的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一份CR报告,我拥有数据库中的所有字段。数据库很大,但所有数据都有一年的数据。我想为用户打印2014年的数据,该怎么做?示例:

用户|车里程|步行里程|运行里程|年| 
100 | 2000年| 3000 | 1000 | 2012 |
100 | 800 | 74 | 520 | 2013 |
100 | 500 | 88 | 528 | 2014 |





因此,在报告中我只希望报告显示2014年的所有数据。可以这样做在CR 2013上?

解决方案

是的,您可以使用选择公式来过滤CR中的数据

  string  selectFormula =   {Report.Fieldname} = 2013​​; 
crystalReportViewer.SelectionFormula = selectFormula;



你可以像这样通过年份

 < span class =code-keyword> int  year =  2013 ; 
string selectFormula = {Report.Fieldname } = +年;
crystalReportViewer.SelectionFormula = selectFormula;



一些有用的信息可以从这里此处


I have a CR report that I am designing and I have all of my fields from the database. The database is a large one but all of the data has a year in it. I want to print out year 2014 data for a user, how will that go? Example:

User | Car Miles | Walk Miles | Run Miles | Year |
100  | 2000      | 3000       | 1000      | 2012 |
100  | 800       | 74         | 520       | 2013 |
100  | 500       | 88         | 528       | 2014 |



So, on the report I just want the report to display all the data that has the Year 2014. Can this be done on CR 2013?

解决方案

Yes, you can use Selection Formula to filter your data in CR

string selectFormula = "{Report.Fieldname} = 2013 ";
crystalReportViewer.SelectionFormula = selectFormula;


you can pass the Year like this also

int year = 2013;
string selectFormula = "{Report.Fieldname} =" +year;
crystalReportViewer.SelectionFormula = selectFormula;


Some useful information can be found from here and here


这篇关于如何根据年份使用数据填充Crystal Reports的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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