Solved

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

Posted on 2006-10-26
4
272 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Suggested Solutions

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…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

840 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