Solved

How to use query's in Crystal reports passing parameters

Posted on 2006-06-13
6
336 Views
Last Modified: 2012-06-21
Hello,

I have been thrown into a task at work and I have had no experience with it.

I have a database of Articles with an Article ID and a query to return an article by entering the article ID in a parameter box.

My company want to move to an executable front end with the access backend because they want to use it on machines without access installed.

Basically, I need some guidance on how to create a crystal report showing data from a query where an ID can be passed from a datagridview on another form. (Hope that makes sense)

I am using VS2005 Professional edition.

I only have minor knowledge of VB

I already have a datagridview that shows a list of articles with a detail button. When this is clicked I want it to load the crystal report showing the data from that item.

Bryan
0
Comment
Question by:bryanford
  • 3
  • 3
6 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 16902145
Download the sample applications here: http://support.businessobjects.com/communityCS/FilesAndUpdates/vbnet_web_samples.exe.asp

or here for Windows apps:
http://support.businessobjects.com/communityCS/FilesAndUpdates/vbnet_win_samples.exe.asp

They're based on VS2003 but the same code should work.  There are several samples in there about passing parameters to a report.

I'm assuming you know how to design the report so that it pulls data based on the parameter and what you need help with is passing the parameter from the application?  If that assumption is wrong let me know and I can give help on the other end of it.
0
 
LVL 1

Author Comment

by:bryanford
ID: 16907033
ive been thinking about it and maybe i am not going the right way about this.

Basically, my project is a really basic knowledgebase with articles, and the part that i am stuck on is displaying an article.

When the user clicks on a detail button in a datagridview from a different form, I need the article to come up containing all the data.

The problem I am having is that I cant use a form with labels because the text length can vary and can cause overflow problems. This is why i thought a report would be better but playing around in the designer sort of says this wont help me either.

Do you know the best way to show this kind of data? We have an internal web version of the knowledgebase and I would like it to look like this: http://www.bryanford.info/screenshot.jpg

Each heading, Title, Problem, Cause, Solution, etc is a different field in the database.

Thanks
Bryan

0
 
LVL 42

Expert Comment

by:frodoman
ID: 16907139
There are several approaches to this that I can think of.

1) Use banding in a heirarchal datagrid so users can drill into the knowledge base and see it all within the grid
2) Use a form with labels and move the labels as needed based on the length of the text (assuming this is a Windows application) or use a form with flowlayout the automatically position the dynamic elements (for a Web application)
3) Use a Crystal report with on-demand subreports.

Option 1 & 2 are .Net application solutions and although I can help somewhat they are better addressed in one of the .Net forums.

For option #3 you basically create a report listing the articles and create a subreport that displays the article content and is linked to the main report by article number (or title or whatever field is unique).  You make the subreport an on-demand type so it doesn't display in the main report but will open when the link in the main report is clicked.  Within the subreport you can use the 'can grow' property to resize the fields as needed and place fields in separate details sections to avoid overlap.

If you need additional help with option #3 I'm happy to assist.

frodoman
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:bryanford
ID: 16907212
Option 2 or 3 sounds the best way to go, however I must stress that this has to be idiot proof. (Its a windows application that is an offline version of our knowledgebase so the elderly can get help before calling our call centre).

So basically, what I am trying to say is that I would like to keep the datagridview form as the startup, then show the report by clicking on the detail button next to that article.

If option 3 still fits under this, would you be able to help me out?

Thanks for your help so far.

Bryan
0
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
ID: 16910790
You want option #4 - a combination of #3 and of what I pointed to the first time.

What you want to do is create a report that has a parameter for the article id.  The select expert in the report should select based on this parameter so you'll be passing in a single id and the report will select the record(s) related to that id.  Within the report you can insert detail sections so you'll have DetailA, DetailB, etc.  Put your first data field in DetailA and make it one row high but in the format options for the field check the 'Can Grow' box.  Put your second field in DetailB and repeat the process.  What this does is if the contents of the first field are 3 lines of text, it allows the field on the report to grow vertically and that will expand the vertical height of the DetailA section so the next field (in DetailB) will get pushed down the page.

That's the basics of what needs to be done with the .rpt itself.  The win_samples link posted earlier contains the vb.net code that you need to pass the parameter value from your application to the report.

Hopefully that gets you on track.

frodoman
0
 
LVL 1

Author Comment

by:bryanford
ID: 16926371
did as you said and does the job well enough :)

thanks very much
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

17 Experts available now in Live!

Get 1:1 Help Now