Last post Jun 06, 2011 12:51 AM by hassanmehmood
Jun 02, 2011 01:33 AM|rasadulalam|LINK
I want to customize my Crystal report like this.. I will maintain a database where I will say what will be the daetime format (mm-dd-yyyy or dd-mm-yyyy ), number format (how many digit after decimal point 2.0000, 2.000, 2.00, 2 etc). When I will call a report
then report will first compare its content type with the database. Then according to the database format report will be displayed.
NB: i ma using asp.net, C# and MS SQL
Thanks in advance.
Jun 02, 2011 02:03 AM|hassanmehmood|LINK
You can pass these settings (formats etc) in your datasource to crystal report. and on the crystal report you ca format using these settings.
Like for setting the decimal points of a number field;
- you can have a column in your datasource (dataset/ datatable) of name "DecimalPoints"
- on report you can right click a numeric field, choose to "Format Object -> Number -> Customize"
- from the small displayd window with the title 'Cusomize style', you can click on the button next to Decimals field. this will open formula workshop for you
- in there just put your datasource column you have for setting decimals "DecimalPoints"
- doing this in formula workshop means that you are specifying the decimal points for your number and all numbers will be formatted as per this.
Same thing you can do with your date fields..
Hope this helps..
Jun 05, 2011 09:11 AM|rasadulalam|LINK
Thanks for reply. But i wat to do some things different. Suppose i have 50 .rpt file. For your suggession i have to change all my 50 .rpt file.I am using one .aspx file for report viewer. If i can write the conde in this .aspx file(reportview page) to solve
my problems then it will be better. Because many peoples are using my app. and they want to customize their number,date formate himself according to time.
Can i control it in report vewer page..(i mean .cs page)
Jun 06, 2011 12:51 AM|hassanmehmood|LINK
For that, you can do something like this..
- Query from your table which has all these formats (date/ decimal formats etc etc)
- Write a method "FormatReportData()" in your cs of report page.
- In that method pass these formats and format the acitve (going to be printed) report
- you can format the data in dataset before binding to report, or after binding to report (by accessing the report objects)
But even in this page too, you need to analyse each report, and apply the formats on them accordingly. Because suppose one of your reports uses only 2 date time fields, whereas, a few of them may use many more date time and decimal fields. so you need to
check and apply the formats differently on them.
And trust me, 50 reports is not a huge number of reports :)