Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mde
Starting Member
10 Posts |
Posted - 2004-12-27 : 07:59:30
|
Hi All!Is it possible to fill list boxes dynamically? What I want is to select a period in one list box, like year-month or year-week, and fill another one with data that matches what I selected in the first list box. For example, if I select "year-month" in the first list box I want the second one to be filled with data like 2004-12, 2005-01, 2005-02 from one of my tables.Thanks in advance! // Maria |
|
jhermiz
3564 Posts |
Posted - 2004-12-27 : 10:04:50
|
Yes its possible, you write two stored procedures, your first one fills in the "year-month". It could be statically defined if it never changes as the source. Then the second stored procedure takes a parameter @blah which is the value in the first drop down. It does some sort of select with a WHERE clause based on yourTable.youRField=@blah.This will then dynamically fill that second combo box. You pass both as report parameters.A new beat on the web -- http://www.web-impulse.com |
 |
|
mde
Starting Member
10 Posts |
Posted - 2004-12-28 : 04:21:42
|
Thanks for your solution, it works fine when used with values. I learned something new :) Is it possible to pass field names as values as well? What I really want to do is select a time frame, say year-month, and pass a field name to a query/stored proc that fills the second list box.// Maria |
 |
|
jhermiz
3564 Posts |
Posted - 2004-12-28 : 15:17:49
|
Well the field name would have to be either in a static query list or a stored procedure that allows you to query the value.You cannot pass Fields!blah to a report.A new beat on the web -- http://www.web-impulse.com |
 |
|
mde
Starting Member
10 Posts |
Posted - 2004-12-29 : 04:14:22
|
I have now found a solution that seems to work I do like this:1) Create a dataset for the first list that will pass a fieldname as a value.2) In layout, choose Report Menu -> Report parameters, select available values from query. Set both label and value.3) Create a second dataset (in my case I execute a stored proc) with a query parameter that has the exact same name as the report parameter I created above (in step 2). In my stored proc I set the AS-name for my field to F1 and uses that name in the Dataset -> Fields tab4) At last I create a second report parameter that uses the dataset above as it source.// Maria |
 |
|
|
|
|
|
|