Solved

Placing a formula field on to Crystal Report from .aspx page

Posted on 2006-10-26
4
269 Views
Last Modified: 2008-02-01
Hi All,
I am using Visual Stuido 2005 and Crystal Reports.NET
Can I place a formula field on to the report from code-behind(.aspx) page

Thanks,
Prasad.
0
Comment
Question by:balabommala
  • 2
4 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 17815568
I believe it is possible.  But it may require all your users to have runtime licenses for Crystal which, last I checked, cost $199 per user.

A way that should work with out requiring the license is to put the formula on the report during design then changing the formula from the code.

From VB it is done liek this

                For k = 1 To crRpt.FormulaFields.Count
                    If (UCase$(crRpt.FormulaFields(k).Name) = "YOURFORMULA")  Then
                        crRpt.FormulaFields(k).Text = "Your Formula in a string"
                    End If
                Next k

mlmcc
0
 
LVL 42

Expert Comment

by:frodoman
ID: 17816342
Prasad,

I believe you can do it and it doesn't require a runtime license (you get distribution rights for the OEM version as part of Visual Studio).  mlmcc is correct though that you're going to be *far* better off simply placing the formula on your report, even if it's completely blank, and modifying the formula contents at runtime.  If this works for you, I have a sample of the .net code I can give you but you'll need to let me know if you're writing a Windows app or a Web app because as I recall the code is slightly different.

frodoman
0
 

Author Comment

by:balabommala
ID: 17836672
Hi
Sorry for my late reply.
I am writing a web application.

Thanks
0
 
LVL 42

Accepted Solution

by:
frodoman earned 125 total points
ID: 17836749
Piece of cake to modify a formula:

  MyReportDocument.DataDefinition.FormulaFields("YourFormulaName").Text = "{field1} * {field2}"

You'll need to write th formula w/in the quotes just like you would in the Crystal editor, so enclose strings in single quotes, etc.  

frodoman
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now