Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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