Solved

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

Posted on 2003-11-19
3
1,387 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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 …
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 shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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…

786 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