For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > June 2005 > Newbie Q - Dynamic Reports









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Newbie Q - Dynamic Reports
Phil

2005-06-01, 8:59 pm

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


Brian Bischof

2005-06-02, 4:01 am

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



"Phil" <Phil@nospam.com> wrote in message
news:d7l77v$bsb$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
> 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
>
>



Phil

2005-06-02, 8:59 pm

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


"Brian Bischof" <Brian@NoSpamBischofSystems.com> wrote in message
news:%23F$L6gzZFHA.3648@TK2MSFTNGP14.phx.gbl...
> 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
>
>
>
> "Phil" <Phil@nospam.com> wrote in message
> news:d7l77v$bsb$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
> include
> would
>
>



Brian Bischof

2005-06-02, 8:59 pm

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


"Phil" <Phil@nospam.com> wrote in message
news:d7nklh$qde$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
> Thanks Brian. I perhaps mistakenly assumed that I could add the fields to
> the report at runtime. I will have 'a play'.
>
>
> "Brian Bischof" <Brian@NoSpamBischofSystems.com> wrote in message
> news:%23F$L6gzZFHA.3648@TK2MSFTNGP14.phx.gbl...
dynamically[color=darkred]
Field2,[color=darkred]
statement[color=darkred]
to[color=darkred]
that[color=darkred]
in[color=darkred]
the[color=darkred]
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com