Solved

[vb.net] Modify parameters at runtime - ParameterDiscreteValue description

Posted on 2003-11-19
3
1,381 Views
Last Modified: 2012-08-13
I have an application that needs to report the current employees on specific departments.
The user must have the option to choose one or more departments to filter the data.

I can add a ParameterField to my report at runtime, I can add ParameterDiscreteValue objects to the DefaultValues collection of the ParameterField, but how can I specify the Description for the Value at runtime? I know this is possible at design time using 'Set Default Values' in the 'Create Parameter' dialog box.

The values are department-IDs (1, 2, 3, etc.) in my database, but I want to give the user the possibility to select the name of the department instead of the ID.

Thanks in advance,

Ruben
0
Comment
Question by:RubenvdLinden
3 Comments
 
LVL 13

Accepted Solution

by:
EwaldL earned 125 total points
ID: 9777943
i can only see 2 options, which would both include writing your own parameter prompt
a) take the string values, then get hold of the correspoding integer value for the department and pass this to the report
b) take the string values and based on this input fill an appropriate dataset and pass this to the report
you could also create a string parameter in the report, which could then be converted to the relevant integer in a formula which can then be used in the record selection formula inside the report. this should mean though that the report will retrieve all records from the database, not just the ones that will be displayed. so i wouldnt advise this just for performance reasons
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9778910
Another option would be to have your parameter prompt display something like this:
1) Department1_Name
2) Department2_Name
3) ...

Then create a formula field to extract the first character from the selected parameter and convert it to a number.  Use this formula field to filter your data.

Note that if you have more than 9 departments you'll want to label them 01, 02, etc. and extract the first 2 characters...
0
 
LVL 12

Author Comment

by:RubenvdLinden
ID: 9816644
Created my own parameter dialog just like EwaldL suggested. It's filled with objects, the ToString function of the objects lists the strings just like I wanted. I extract the IDs from the selected objects to pass to the parameter field.

Thank you both for your answers.
0

Featured Post

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!

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…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

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

12 Experts available now in Live!

Get 1:1 Help Now