Solved

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

Posted on 2006-10-26
4
273 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 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