473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Crystal Report unbound fields

Hi,

I'm using Visual Studio 2003 (C#) with the integrated
Crystal Report software and have the following question:

How can I assign a value (string) to an unbound (string)
field in Crystal Report at runtime?

Example:
private void button1_Click(object sender,
System.EventArgs e)
{
DiskFileDestinationOptions Options = new
DiskFileDestinationOptions();
Options.DiskFileName = @"c:\test.pdf";
CrystalReport1 rep = new CrystalReport1();

//insert code to assign "my text" to the unbound
field "UnboundString1"???

rep.ExportOptions.ExportFormatType =
ExportFormatType.PortableDocFormat;
rep.ExportOptions.ExportDestinationType =
ExportDestinationType.DiskFile;
rep.ExportOptions.DestinationOptions = Options;
rep.Export();
}

Any help is appreciated
Many thanks
Stephan
Jul 19 '05 #1
1 19106
Hello Ries,

From your description, we could see that the issue should be known before,
since there was a patch for it. I suggest you post your question at
http://www.crystaldecisions.com/. Though it ships with Visual Studio,
Crystal Reports is supported by Crystal Decisions. We have no source code
of it. They have a self-help section and they offer phone & e-mail support.
Their web sites states that you get two Crystal incidents with the purchase
of Visual Studio .NET.

Thanks very much for your understanding.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Ries Spruit" <ru**********@spruit-it.nl>
!Sender: "Ries Spruit" <ru**********@spruit-it.nl>
!References: <02****************************@phx.gbl>
<QJ**************@cpmsftngxa06.phx.gbl>
!Subject: RE: Crystal Report unbound fields
!Date: Fri, 5 Sep 2003 02:58:59 -0700
!Lines: 192
!Message-ID: <22****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNzlFOG867Yx6kdQy+OAHqlPakujw==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107406
!NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
!X-Tomcat-NG: microsoft.public.dotnet.general
!
!Hello Yanhong,
!
!In the context of this thread I'd like to know if you or
!anyone else has been able to assign a string containing
!newline characters to an unbound field. My experience is
!that \n and \t characters are completely ignored by the
!Crystal Reports engine.
!
!I want to show a lengthy string on a report. First I
!tried this using a report parameter but then I run into a
!bug (ADAPT00138140
!http://support.crystaldecisions.com/...kbase/articles
!/c2010907.asp) for which a patch seems to be available,
!but NOT for OEM products.. I cannot get this installed
!with Visual Studion 2003 / .Net 1.1. The bug does not
!allow you to use String parameters longer then 255
!characters.
!
!So next I tried the way of the unbound field. But now
!newlines are ignored, so this is not working either.
!Somehow Crystal Reports seems very reluctant to work for
!me :-(
!
!Eagerly awaiting your reponse,
!
!Kind regards,
!Ries Spruit
!
!
!
!
!
!>-----Original Message-----
!>Hello Stephan,
!>
!>The following is a short code snippet to give you an
!idea of what we have had to do to pass data to Unbound
!Fields. Please
!>note that the process below is not dynamic and is just
!work in progress to better learn how to make the
!reporting process
!>work. Some other things to note are the fact that the
!name of the Unbound Fields (on the report) and the
!Formula Field
!>Definitions (in code) are the same. This is simply to
!avoid confusion on my part. When an Unbound Field is
!created, it is
!>listed under Formula Fields. There is no good way to
!tell one from another. Suffice to say that if a field is
!listed under Formula
!>Fields and it appears on the report, it is in fact an
!Unbound Field.
!>
!>public ReportViewerForm(string reportName)
!>{
!>//
!>// Required for Windows Form Designer support
!>//
!>InitializeComponent();
!>//
!>// TODO: Add any constructor code after
!InitializeComponent call
!>//
!>//formulas that will contain the field name
!>FormulaFieldDefinition DailyTellerTotalsReport;
!>FormulaFieldDefinition TransactionSummary;
!>FormulaFieldDefinition lblBank;
!>FormulaFieldDefinition valBank;
!>//Instantiate a Crystal Reports ReportDocument as
!myReport
!>CrystalDecisions.CrystalReports.Engine.ReportDoc ument
!myReport = new
!>CrystalDecisions.CrystalReports.Engine.ReportDoc ument();
!>//Load the needed report into myReport ?reportName is
!the path and name
!>//of the form to be used
!>myReport.Load(reportName);
!>//Set up Unbound Field definitions
!>FormulaFieldDefinitions crFormulas;
!>crFormulas = myReport.DataDefinition.FormulaFields;
!>//set the unbound fields
!>DailyTellerTotalsReport = crFormulas
!["DailyTellerTotalsReport"];
!>TransactionSummary = crFormulas["TransactionSummary"];
!>lblBank = crFormulas["lblBank"];
!>valBank = crFormulas["valBank"];
!>//Assign values ?Again, please note that the variable
!that have been defined
!>//have THE SAME NAME as the Unbound Fields on the report.
!>DailyTellerTotalsReport.Text = "\"Daily Teller Totals
!Report\"";
!>TransactionSummary.Text = "\"TransactionSummary\"";
!>lblBank.Text = "\"Bank\"";
!>valBank.Text = "\"Jamisonville\"";
!>//Set the viewer's report source to myReport
!>crViewer.ReportSource = myReport;
!>//Show the report maximized
!>this.WindowState = FormWindowState.Maximized;
!>}
!>
!>Besides, Crystal Reports for VS.NET will not allow you
!to add a database to a report at runtime. The report
!needs to have a
!>data structure in order for it to work. The report can
!connect to any datasource including a .NET dataset. For
!dynamic
!>reports, you can add a number of formula fields on the
!report and at runtime you can populate those formula
!fields and tell
!>them which database fields to display. We have a sample
!on this:
!><http://support.crystaldecisions.com/...ityCS/FilesAnd
!Updates/vbnet_win_dynamic_report_formula.exe.asp>
!>
!>It's in vb.net but the code is the same for C# as well.
!>
!>If you need to be able to dynamically create a report
!from scratch at runtime, you will need access to our RAS
!object model.
!>RAS 9 comes with Crystal Reports 9. The object model
!that will allow you to do this is in Crystal Reports 9
!Advanced version.
!>
!>Hope that helps.
!>
!>Best regards,
!>Yanhong Huang
!>Microsoft Online Partner Support
!>
!>Get Secure! - www.microsoft.com/security
!>This posting is provided "AS IS" with no warranties, and
!confers no rights.
!>
!>--------------------
!>!Content-Class: urn:content-classes:message
!>!From: "Stephan" <st**************@ggaweb.ch>
!>!Sender: "Stephan" <st**************@ggaweb.ch>
!>!Subject: Crystal Report unbound fields
!>!Date: Fri, 15 Aug 2003 14:23:30 -0700
!>!Lines: 31
!>!Message-ID: <02****************************@phx.gbl>
!>!MIME-Version: 1.0
!>!Content-Type: text/plain;
!>! charset="iso-8859-1"
!>!Content-Transfer-Encoding: 7bit
!>!X-Newsreader: Microsoft CDO for Windows 2000
!>!Thread-Index: AcNjc3k5m8FXrjRnQJiX5hiqLCkiEw==
!>!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!>!Newsgroups: microsoft.public.dotnet.general
!>!Path: cpmsftngxa06.phx.gbl
!>!Xref: cpmsftngxa06.phx.gbl
!microsoft.public.dotnet.general:104727
!>!NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
!>!X-Tomcat-NG: microsoft.public.dotnet.general
!>!
!>!Hi,
!>!
!>!I'm using Visual Studio 2003 (C#) with the integrated
!>!Crystal Report software and have the following question:
!>!
!>!How can I assign a value (string) to an unbound
!(string)
!>!field in Crystal Report at runtime?
!>!
!>!Example:
!>!private void button1_Click(object sender,
!>!System.EventArgs e)
!>!{
!>! DiskFileDestinationOptions Options = new
!>!DiskFileDestinationOptions();
!>! Options.DiskFileName = @"c:\test.pdf";
!>! CrystalReport1 rep = new CrystalReport1();
!>!
!>! //insert code to assign "my text" to the unbound
!>!field "UnboundString1"???
!>!
!>! rep.ExportOptions.ExportFormatType =
!>!ExportFormatType.PortableDocFormat;
!>! rep.ExportOptions.ExportDestinationType =
!>!ExportDestinationType.DiskFile;
!>! rep.ExportOptions.DestinationOptions = Options;
!>! rep.Export();
!>!}
!>!
!>!Any help is appreciated
!>!Many thanks
!>!Stephan
!>!
!>
!>
!>.
!>
!

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rick Thiel | last post by:
Hello, I am trying to build a Crystal report VisualStudio.NET for an ASP.NET application. I would like to build a report that doesn't connect to any particular database at design time because I...
0
by: Steve | last post by:
I know this might not be the best place to get help for this particular problem, but here goes.. The 2nd edition of ProfessionalCrystal Reports for Visual Studio .NET states "you will learn how to...
2
by: Pierre | last post by:
Hi, Can anyone tell me how I can populate Crystal Reports, using a DataTable in C#? Regards, Pierre
3
by: Diggler | last post by:
I was working on a report that is populated with three different tables in a strongly-typed dataset. The tables are populated from custom objects rather than directly from SQL Server. I loop...
0
by: Téo | last post by:
Hi, I have created a crytal report based on a table of my SQL Server. Everything works fine. I would like now to fill my report with a sql request in the code behind instead of the table in the...
3
by: Téo | last post by:
I don't see my question with my newsreader, just try to post a last time, sorry if it's (one more...) bug of OE... Hi, I have created a crytal report based on a table of my SQL Server....
1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
3
by: Tmuld | last post by:
Hello, I was provided a .rpt file which is Crystal Reports report. It opened with VS .NET 2003. On the left side in the Field Explorer - there are seveal categories - Database Fields -...
0
by: amiga500 | last post by:
Hello, I am developing a crystal report called Expense Report (I am not an expert Crystal Report designer) if someone could help me in this problem I would be greatly appreciate it. The report...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.