locked
Crystal Report Format Problem RRS feed

  • Question

  • User2120624532 posted

    I want to customize my <st1:city><st1:place>Crystal</st1:place></st1:city> 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.

     

    Rashed

    Thursday, June 2, 2011 1:33 AM

Answers

  • User-1364446067 posted

    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 :)

     

    --

    Hope this helps..

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 6, 2011 12:51 AM

All replies

  • User-1364446067 posted

    Hi.

    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..

     

    Thursday, June 2, 2011 2:03 AM
  • User2120624532 posted

    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)

    Sunday, June 5, 2011 9:11 AM
  • User-1364446067 posted

    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 :)

     

    --

    Hope this helps..

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 6, 2011 12:51 AM