Chart based on parameters selected?

  • I've got a very simple report which pulls through some daily totals from a table - literally select * from tblA returns a date column and three columns with values.

    Producing a chart of this is easy enough.

    Restricting this chart via a filter using DateAdd(DateInterval.Month, -1, Today()) to just return the last months worth of data is easy enough.

    I've now added two parameters Date Min and Date Max, when the user chooses these the data table returned is just for the time period specified, what I want is for the graph to also reflect this time period - i.e. for the graph to plot based on the date ranges chosen in the parameters. I've had a look and I can't suss out how to do this.

    Can it be done?

  • It would probably be best to let the query filter the data by passing the parameters to the query, as such:

    select * from tblA where YourDateField >= @DateMin and YourDateField <= @DateMax

    If that's not an option you like you should be able to filter the chart in the same manner, just apply two filters to the chart to accomodate the date range:

    Add Filter -

    Expression = YourDateField

    Operator = >=

    Value = @MinDate (select parameter value in the Expression window)

    and a second filter for <= @MaxDate

    [font="Courier New"]Looking for a Deadlock Victim Support Group..[/font]
  • Many thanks Burninator, the second approach seems to work well, I'm not too sure why I didn't think of just making the chart look to the parameters rather than just hard coding date ranges - seems so logical (and I'm sure I use similar tricks elsewhere in other reports!)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply