VB Crystal Report >> Newbie Q - Dynamic Reports

by Phil » Thu, 02 Jun 2005 04:53:20 GMT

Hi all,

I am new to CR. I have VS.NET2003 (ie. CR9). Would some kind 'expert' help
with some example code for adding dynamic data to a report (preferably in
VB.NET).......

Let's say I let the user choose which fields from a db they wish to include
in the report. How do I now add those fields to the Detail Section of the
report? And furthermore, how do I format the report so that the columns of
data are nicely spaced? Can I also set up the report to view/print in
landscape instead of portrait?

If someone could provide a simple example with 2 or 3 fields then that would
be really helpful to me.

Thanks in advance.

Phil




VB Crystal Report >> Newbie Q - Dynamic Reports

by Brian Bischof » Thu, 02 Jun 2005 13:59:25 GMT


You have to get creative with your SQL statements. You need to dynamically
build the SQL so that each field is given a generic name (Field1, Field2,
etc.) Then when the user selects which fields to display the SQL statement
maps them to the generic field names. This lets CR recognize the field names
and fill in the data. If the number of fields can change, then you have to
put as many fields as necessary on the report and then hide the ones that
don't get used.

HTH,

Brian Bischof
www.CrystalReportsBook.com





include
would





VB Crystal Report >> Newbie Q - Dynamic Reports

by Phil » Fri, 03 Jun 2005 02:54:41 GMT

Thanks Brian. I perhaps mistakenly assumed that I could add the fields to
the report at runtime. I will have 'a play'.










Newbie Q - Dynamic Reports

by Brian Bischof » Fri, 03 Jun 2005 03:13:41 GMT

You can add fields at runtime if you upgrade to CR Server. But for the free
.NET version its not included.

HTH,

Brian Bischof
www.CrystalReportsBook.com






dynamically
Field2,
statement
to
that


in
the




Similar Threads

1. Dynamic Report using Crystal Reports XI

Good morning,

I have to develop an application within which the user is able to print 
reports (this is done using Visual Basic 6 and Crystal Reports XI). This 
works fine as long the reports can be designed as is.
But now users want a dynamic report: One user wants to print all 
columns, but others only want to print column 1 and 2 from a database 
table (e.g. name and birthdate). How could this be done using Crystal 
Reports XI? Could I pass the field names from Visual Basic 6 to Crystal 
Reports XI?


Thank you in advance

Stefan Wagenbrenner

2. [Newbie] Method Calls and Dynamic Casting - VB.Net

3. .NET - dynamic DataSource (newbie)

hello,

i need some help getting my first project w/ CR going.

its an ASP.NET project. for report deployment, i chose not to embed the
.RPTs as resources, and am instead simply copying them the server's
file system, thus avoiding rebuilds. at runtime i pick them up in a
"reportViewer.aspx" page, which maps out the full path for a given .RPT
and loads it into a ReportDocument object. works for me.

however, now ive got two datasource environments -- production & dev.
in the past, ive just set the data source in my Crystal Reports v9
application designer (not integrated w/ VS.NET) and saved it. but now
since i have two seperate web & data environments, i need to make it
dynamic.

i see that the ReportDocument object has a .SetDataSource() method --
can anyone show me how its used? ive tried the help file that i have,
but its the application's help file, not the .NET
"CrystalDecisions.CrystalReports.Engine" namespace's help file. (can
anyone point me to that?)


thanks!
matt

4. RegExp & VB Noob Qs - Excel

5. 2 Qs - "Invalid picture" message when opening an excel VBA application

Hi,

I have this excel file where I have put VBA code and it 
runs fine on my computer but I one of my users gets 
an "invalid picture" message when they open the file.

Please advise.

I thought that some excel Dlls might be missing and tried 
to package this file using Developer2000 but they, when 
they click on set.exe if seems to get stuck and gives a 
message:" please re-start the computer." When they do, no 
progress. I thought it was an admin rights issue, but that 
is not the case.

Please help.

Thanks,

gopal

6. Qs on .avi clips in VB...