?
Solved

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

Posted on 2006-10-26
4
Medium Priority
?
276 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 101

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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. …
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

765 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