Solved

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

Posted on 2003-11-19
3
1,396 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

735 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