473,738 Members | 7,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(o bject sender,
System.EventArg s e)
{
DiskFileDestina tionOptions Options = new
DiskFileDestina tionOptions();
Options.DiskFil eName = @"c:\test.pd f";
CrystalReport1 rep = new CrystalReport1( );

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

rep.ExportOptio ns.ExportFormat Type =
ExportFormatTyp e.PortableDocFo rmat;
rep.ExportOptio ns.ExportDestin ationType =
ExportDestinati onType.DiskFile ;
rep.ExportOptio ns.DestinationO ptions = Options;
rep.Export();
}

Any help is appreciated
Many thanks
Stephan
Jul 19 '05 #1
1 19178
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**********@s pruit-it.nl>
!Sender: "Ries Spruit" <ru**********@s pruit-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: AcNzlFOG867Yx6k dQy+OAHqlPakujw ==
!Newsgroups: microsoft.publi c.dotnet.genera l
!Path: cpmsftngxa06.ph x.gbl
!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:107406
!NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
!X-Tomcat-NG: microsoft.publi c.dotnet.genera l
!
!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 ReportViewerFor m(string reportName)
!>{
!>//
!>// Required for Windows Form Designer support
!>//
!>InitializeCom ponent();
!>//
!>// TODO: Add any constructor code after
!InitializeComp onent call
!>//
!>//formulas that will contain the field name
!>FormulaFieldD efinition DailyTellerTota lsReport;
!>FormulaFieldD efinition TransactionSumm ary;
!>FormulaFieldD efinition lblBank;
!>FormulaFieldD efinition valBank;
!>//Instantiate a Crystal Reports ReportDocument as
!myReport
!>CrystalDecisi ons.CrystalRepo rts.Engine.Repo rtDocument
!myReport = new
!>CrystalDecisi ons.CrystalRepo rts.Engine.Repo rtDocument();
!>//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
!>FormulaFieldD efinitions crFormulas;
!>crFormulas = myReport.DataDe finition.Formul aFields;
!>//set the unbound fields
!>DailyTellerTo talsReport = crFormulas
!["DailyTellerTot alsReport"];
!>TransactionSu mmary = crFormulas["TransactionSum mary"];
!>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.
!>DailyTellerTo talsReport.Text = "\"Daily Teller Totals
!Report\"";
!>TransactionSu mmary.Text = "\"TransactionS ummary\"";
!>lblBank.Text = "\"Bank\"";
!>valBank.Text = "\"Jamisonville \"";
!>//Set the viewer's report source to myReport
!>crViewer.Repo rtSource = myReport;
!>//Show the report maximized
!>this.WindowSt ate = 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_dynam ic_report_formu la.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: AcNjc3k5m8FXrjR nQJiX5hiqLCkiEw ==
!>!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!>!Newsgroups: microsoft.publi c.dotnet.genera l
!>!Path: cpmsftngxa06.ph x.gbl
!>!Xref: cpmsftngxa06.ph x.gbl
!microsoft.publ ic.dotnet.gener al:104727
!>!NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
!>!X-Tomcat-NG: microsoft.publi c.dotnet.genera l
!>!
!>!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(o bject sender,
!>!System.Event Args e)
!>!{
!>! DiskFileDestina tionOptions Options = new
!>!DiskFileDest inationOptions( );
!>! Options.DiskFil eName = @"c:\test.pd f";
!>! CrystalReport1 rep = new CrystalReport1( );
!>!
!>! //insert code to assign "my text" to the unbound
!>!field "UnboundString1 "???
!>!
!>! rep.ExportOptio ns.ExportFormat Type =
!>!ExportFormat Type.PortableDo cFormat;
!>! rep.ExportOptio ns.ExportDestin ationType =
!>!ExportDestin ationType.DiskF ile;
!>! rep.ExportOptio ns.DestinationO ptions = 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
14283
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 am planning to pass a dataset to the report at runtime. From what I have read, it sounds like unbound fields might be the answer. However, I am having trouble figuring out how to bind these unbound fields to my dataset at runtime.
0
2578
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 bind data from your project with this field..." regarding unbound fields. I cannot find where this is explained anywhere in the book I want to assign a string to an unbound field in my Crystal Report and I can't figure out the code This is...
2
18862
by: Pierre | last post by:
Hi, Can anyone tell me how I can populate Crystal Reports, using a DataTable in C#? Regards, Pierre
3
5244
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 through the objects and add the rows one at a time. I then push the dataset to the Crystal Report. The report worked fine, until this morning. I added another field or two to the dataset, and rearranged the report fields to organize the report...
0
303
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 crystal report. But in the following code, the dataset created isn't "used" by the crystal report wich continues to use the table. And if i delete the table in the crystal report to use unbound fields, it doesn't work.
3
1657
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. 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 crystal report. But in the following code, the dataset created isn't "used" by the crystal
1
713
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 Report at runtime? Example: private void button1_Click(object sender,
3
36466
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 - Formula Fields
0
1878
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 would be as follows: Description Sun Mon
0
8969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9476
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9263
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.