I am in need of some advice on my first project.
I have a chart which displays as I would expect when a static query is
executed. I need to somehow dynamically add the datafields to the chart at
runtime which is where I am coming unstuck. The number and name of
datafields could change each time the report is run so they absolutely need
to be dynamic.
Any advice on the best way to approach thsi problem would be much
appreciated.
Thanks, SimonDoes anyone have experience in creating Reports with Dynamic fields like
this. The only solution I can think of is to programatically build the RDL
each time, save it to the server then call the report to render it for the
client. It seems very inefficient which is why I wanted to ask others with
more experience in this field '?
Simon
"Simon Dingley" <newsgroups@.nospam-creativenrg.co.uk> wrote
> I am in need of some advice on my first project.
> I have a chart which displays as I would expect when a static query is
> executed. I need to somehow dynamically add the datafields to the chart at
> runtime which is where I am coming unstuck. The number and name of
> datafields could change each time the report is run so they absolutely
need
> to be dynamic.
> Any advice on the best way to approach thsi problem would be much
> appreciated.
> Thanks, Simon
>
Showing posts with label advice. Show all posts
Showing posts with label advice. Show all posts
Wednesday, March 7, 2012
dynamic where clause
Hi
I need some advice on which direction to take!
Consider this statement:
SELECT business_name FROM myTable WHERE town = @.town AND county = @.county
My problem is that i will not always have the @.county variable available. Is there a way to use an IF or a CASE inside the SQL statement (i know i can create two seperate sql statments but dont want to do it this way)? If it makes it easier, when the @.county variable is not available, it has a value of 0.
thanks again
Ps, i also know how to do it using dynamic sql using the EXEC() command, but i'd prefer to steer clear of this method also.SELECT business_name
FROM myTable
WHERE (town = @.town OR @.town IS NULL)
AND (county = @.county OR @.county = 0)
?|||Hi pootle
If the @.county has a value of 0 then i don't want to make it part of the WHERE clause, ie i dont want it to search the county column - in your example it would search all counties which are equal to 0?
This is what i'm trying to acheive, but only use one SELECT statment:
IF @.county <> '0'
BEGIN
SELECT business_name FROM myTable WHERE town = @.town AND county = @.county
END
ELSE
BEGIN
SELECT business_name FROM myTable WHERE town = @.town
END|||Hi Mattock
Did you try the code? I know the answer is no :) It does just what you ask for.|||lol, i'm real sorry, got the monday morning blues! Thick mode was well and truly stuck to 'ON'.
cheers again|||No probs :)
I need some advice on which direction to take!
Consider this statement:
SELECT business_name FROM myTable WHERE town = @.town AND county = @.county
My problem is that i will not always have the @.county variable available. Is there a way to use an IF or a CASE inside the SQL statement (i know i can create two seperate sql statments but dont want to do it this way)? If it makes it easier, when the @.county variable is not available, it has a value of 0.
thanks again
Ps, i also know how to do it using dynamic sql using the EXEC() command, but i'd prefer to steer clear of this method also.SELECT business_name
FROM myTable
WHERE (town = @.town OR @.town IS NULL)
AND (county = @.county OR @.county = 0)
?|||Hi pootle
If the @.county has a value of 0 then i don't want to make it part of the WHERE clause, ie i dont want it to search the county column - in your example it would search all counties which are equal to 0?
This is what i'm trying to acheive, but only use one SELECT statment:
IF @.county <> '0'
BEGIN
SELECT business_name FROM myTable WHERE town = @.town AND county = @.county
END
ELSE
BEGIN
SELECT business_name FROM myTable WHERE town = @.town
END|||Hi Mattock
Did you try the code? I know the answer is no :) It does just what you ask for.|||lol, i'm real sorry, got the monday morning blues! Thick mode was well and truly stuck to 'ON'.
cheers again|||No probs :)
Subscribe to:
Posts (Atom)