Solved

How to select fields to display in a report

Posted on 2011-03-23
13
204 Views
Last Modified: 2012-05-11
Hello

I have a report with 10 data fields, I would like users to run a report and give them the option to include the data fileds they desire by checking their title on a check box. How do I include the fields on a report based on which checkbox is checked?

Thanks,

Victor
0
Comment
Question by:vcharles
  • 7
  • 6
13 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 35203824
There is no easy way to do that.

One way which leaves much whote space is to put all the fields on the report then using parameters suppress the ones not chosen.

Are all fields the same data type? For example all text ot numeric?

mlmcc
0
 

Author Comment

by:vcharles
ID: 35204060
Yes the are all text, datasource is an XML file. How would you suppress the fields and how would it impact the spacing between the fields? Would they automatically rearrange?

Thanks,

Victor
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35204113
No they would not rearrange.

If they are all text fields then you could use formulas for the report

How will you call the report?
Formulas can be changed from the application.

mlmcc
0
 

Author Comment

by:vcharles
ID: 35204146
I'm using the following approach with VB.NET:

DonorXML1.RecordSelectionFormula = "{Donor.DonorName} like " & "'*" & TextBox1.Text & "*'" & ""
With DonorXML1
CrystalReportViewer1.ReportSource = DonorXML1
End With

Thanks,

V.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35204183
What version of Crystal?

mlmcc
0
 

Author Comment

by:vcharles
ID: 35204191
version 2008
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 100

Expert Comment

by:mlmcc
ID: 35204402
Is that the standalone or the version that comes with VS2008?

mlmcc
0
 

Author Comment

by:vcharles
ID: 35205705
It is the standalone version.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 35212263
Try this idea

In the report create 10 formulas
They can simply be an empty string " "
Name the checkboxes as an array of checkboxes
Declare 2 integer variables
Index
FormulaIndex
Syntax for the application is approximate since I don't know .Net

In the application
DonorXML1.RecordSelectionFormula = "{Donor.DonorName} like " & "'*" & TextBox1.Text & "*'" & ""
FormulaIndex = 0
For Index = 0 to 9
    If CheckBox(Index) = CHCECKED then
          FormulaIndex  = FormulaIndex  + 1
          DonorXML1.Formulas(FormulaIndex 0.Text = CheckBox(Index).FieldName - Not Sure how you do this
    End if
With DonorXML1
CrystalReportViewer1.ReportSource = DonorXML1
End With

mlmcc
0
 

Author Comment

by:vcharles
ID: 35227124
Hi,

Main problem is I need to rearrage the columns when I remove certain columns, is that at all possible in Crystal Reports?

Thanks for the code.

Victor
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35227206
No.

However the code I provided uses the formulas from left to right assuming they are put on the report in that order.

mlmcc
0
 

Author Comment

by:vcharles
ID: 35227445
I will check to see if I can use this feature.

Thank you for the solution.

Victor
0
 

Author Closing Comment

by:vcharles
ID: 35227448
Thank You!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now