Tuesday, March 27, 2012
Easy Stuff
-PatP|||thnx Pat...|||That didn't hurt much, now did it ?!?!
Anywho, while I'm sure that somebody here could have answered your question, why bother to ask here when there are oodles of folks that are readily available that can answer you? Better still, they can offer lots of insight because they actually USE MS-Access as their tool of choice.
-PatP
Friday, March 9, 2012
Dynamically changing position of Textbox
Hi,
In my report, I've to print the address of the customer in a form which is in a pre-defined format. So while printing, the line number and position should be specified by the user. Is there any ways in SSRS to change the position of a textbox/any control dynamically by inputing the x and y coordinates? If there is a way please let me know that.
Thanks in Advance,
Leks
What does the surrounding content in the layout look like? Do you have a "clear" region in which you could place a very large textbox, representing the all the page area in which the textbox could potentially be placed?
If so, you might be able to do this with padding. IOW, you would place this very large textbox in the layout and then you would pad the top and left to "push" the content of the text box into the customer's preferred position, at runtime.
This is possible because you can express the padding values as expressions. Think of the textbox's true top and left as an offset from 0,0, which you will subtract from the customer's input values (which will be parameters) to get the padded top and left at runtime.
HTH,
>L<
|||Hi Lisa,
Thanks for your quick reply. But unfortunately my layout is not clear. It contains other data too that I need to position according to the input for them. For each item in the report we have to enter the position. I know this process is a bit tedious. but there is no other ways. They actualy need the report data such that it can be printed in many forms. Please reply as soon as possible.
Thank you dear,
Leks
|||Hi Leks,
If you have to enter the position of each item in the report, then I think your best option is to edit the RDL on the fly, put your coordinates right in the report definition.
Are you comfortable with doing this? It may be quite straightward. Some things that would enter into it and might change what you have to do would include:
* -- What type of data region are you using (list/table) to contain the dynamic items?
* -- Are there additional items in the report that are *not* dynamically positioned, for example is this an order header you are trying to position so that it fits in a window envelope with a table of order lines that is relatively static?
>L<
|||Hi Lisa,
Here all the data should change position dynamically. So Your solution shoud work. But I didnt get it. How we can change the rdl on the fly?
Thanking you,
Leks
|||You can write a whole RDL on the fly if you want to. Look for an example called something like "generate RDL dynamically" on http://gotreportviewer.com/ and there is another example there that will show you how to LoadReportDefinition for a local report from a stream. If the report is a serverreport, you could use the SOAP API to upload the adjusted report definition instead.
In your case, I don't think that it will be necessary to write the whole RDL from scratch (although you will still have to load or upload your revised version). You can have a "template" RDL that you adjust, for each run or each customer, or as needed.
There are two ways to do an RDL template revision, the way I would do it and the way most developers would prefer to do it <g>. I prefer XSLT; in this case I might have a parameter in the XSLT for each positionable item in the report, or pass the entire set of adjustments in the form of a lookup document. If you prefer to load up the RDL in the DOM and select the textboxes as nodes to adjust each of them, this is pretty easy too.
Do you need more help than this, or is this what you're looking for?
>L<
|||Hi Lisa,
Yes. This was what I was looking for. Now I know that using the XSLT we can position the textbox or any control dynamically.
Thank you so much Lisa,
Leks
|||Great -- if you get stuck, holler. I am very willing to go the extra mile for other folks who like XSLT <s>.
>L<
Dynamically changing position of Textbox
Hi,
In my report, I've to print the address of the customer in a form which is in a pre-defined format. So while printing, the line number and position should be specified by the user. Is there any ways in SSRS to change the position of a textbox/any control dynamically by inputing the x and y coordinates? If there is a way please let me know that.
Thanks in Advance,
Leks
What does the surrounding content in the layout look like? Do you have a "clear" region in which you could place a very large textbox, representing the all the page area in which the textbox could potentially be placed?
If so, you might be able to do this with padding. IOW, you would place this very large textbox in the layout and then you would pad the top and left to "push" the content of the text box into the customer's preferred position, at runtime.
This is possible because you can express the padding values as expressions. Think of the textbox's true top and left as an offset from 0,0, which you will subtract from the customer's input values (which will be parameters) to get the padded top and left at runtime.
HTH,
>L<
|||Hi Lisa,
Thanks for your quick reply. But unfortunately my layout is not clear. It contains other data too that I need to position according to the input for them. For each item in the report we have to enter the position. I know this process is a bit tedious. but there is no other ways. They actualy need the report data such that it can be printed in many forms. Please reply as soon as possible.
Thank you dear,
Leks
|||Hi Leks,
If you have to enter the position of each item in the report, then I think your best option is to edit the RDL on the fly, put your coordinates right in the report definition.
Are you comfortable with doing this? It may be quite straightward. Some things that would enter into it and might change what you have to do would include:
* -- What type of data region are you using (list/table) to contain the dynamic items?
* -- Are there additional items in the report that are *not* dynamically positioned, for example is this an order header you are trying to position so that it fits in a window envelope with a table of order lines that is relatively static?
>L<
|||Hi Lisa,
Here all the data should change position dynamically. So Your solution shoud work. But I didnt get it. How we can change the rdl on the fly?
Thanking you,
Leks
|||You can write a whole RDL on the fly if you want to. Look for an example called something like "generate RDL dynamically" on http://gotreportviewer.com/ and there is another example there that will show you how to LoadReportDefinition for a local report from a stream. If the report is a serverreport, you could use the SOAP API to upload the adjusted report definition instead.
In your case, I don't think that it will be necessary to write the whole RDL from scratch (although you will still have to load or upload your revised version). You can have a "template" RDL that you adjust, for each run or each customer, or as needed.
There are two ways to do an RDL template revision, the way I would do it and the way most developers would prefer to do it <g>. I prefer XSLT; in this case I might have a parameter in the XSLT for each positionable item in the report, or pass the entire set of adjustments in the form of a lookup document. If you prefer to load up the RDL in the DOM and select the textboxes as nodes to adjust each of them, this is pretty easy too.
Do you need more help than this, or is this what you're looking for?
>L<
|||Hi Lisa,
Yes. This was what I was looking for. Now I know that using the XSLT we can position the textbox or any control dynamically.
Thank you so much Lisa,
Leks
|||Great -- if you get stuck, holler. I am very willing to go the extra mile for other folks who like XSLT <s>.
>L<
Wednesday, March 7, 2012
Dynamically adding values to line chart
the chart from the data in my dataset. The problem is that the number of
values to be drawn on the chart may change each time a report is generated
and so I cannot add the values manually in the report designer. So for
example one report may have 5 values to be drawn on the chart Value1,
Value2, Values3... but then another report may only contain 2 values in the
dataset that need to be drawn on the chart.
Each value (Value1...) in the dataset belongs to the same row and so it is
the number of columns in each row which can vary each time a report is
generated.
First report generated (5 columns):
Value1 Value2 Value3 Value4 Value5
10 20 54 32 67
Second Report generated (2 columns):
Value1 Value2
45 2
Does anybody know how I can add values dynamically to a line chart?Hi Holmes,
Welcome to use MSDN Managed Newsgroup!
From your descriptions, I understood you would like to generate a Chart
with dynamic columns and its values. However, I am not sure what's the data
for your X-axis and Y-axis. Would you please show me a detailed
information? (For example, the chart will be has such points (1,10), (2,
20), (3,54), (4,32), (5, 67) )
In the Chart properties, we may notice that you will have to add Fields /
Expressions that based on Fields for your Values / Category Group / Series
Group, we cannot add columns dynamically. You will have to convert the data
in the same row into same column.
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi
Thanks for the reply. From what I understand you are suggesting I should
convert the dynamic values into just one column.
Here is a more detailed description of the data I have. Each query returns a
number of rows which have an ID, Value (Integer), and then a dynamic number
of Bands (Band1, Band2 ... which are Integers). However the number of bands
is constant for all rows from a single query but is does change each time
the query is executed.
So I may have
ID Value Band1 Band2
1033 25 30 60
1034 35 30 60
The bands need to be represented as straight lines drawn horizontally across
the line chart.
The Values need to be plotted as points and then a line drawn connected them
all.
So I can put the Band values into a single column but how will this help?
How can I get the Band values back from a single column?
Kind Regards
Lewis Holmes
"Michael Cheng [MSFT]" <v-mingqc@.online.microsoft.com> wrote in message
news:ZiTlmYovFHA.780@.TK2MSFTNGXA01.phx.gbl...
> Hi Holmes,
> Welcome to use MSDN Managed Newsgroup!
> From your descriptions, I understood you would like to generate a Chart
> with dynamic columns and its values. However, I am not sure what's the
> data
> for your X-axis and Y-axis. Would you please show me a detailed
> information? (For example, the chart will be has such points (1,10), (2,
> 20), (3,54), (4,32), (5, 67) )
> In the Chart properties, we may notice that you will have to add Fields /
> Expressions that based on Fields for your Values / Category Group / Series
> Group, we cannot add columns dynamically. You will have to convert the
> data
> in the same row into same column.
> Thank you for your patience and cooperation. If you have any questions or
> concerns, don't hesitate to let me know. We are always here to be of
> assistance!
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Hi Lewis,
If the Bands number are not sure, I am afraid you cannot add these values
dynamically. As I have said, you must convert the tables like below
Line1: (for Band1)
X-axis Y-axis
1033 30
1033 60
Line2: (for Band2)
X-axis Y-axis
1034 30
1034 60
Make sure what was the X-axis and Y-axis value you want in the table and
then compose a line.
If you have any more tables or pictures to demonstrate this scenario more
clearly, you are welcome to send the files here or send them to me directly
if you have security concerns. my direct email address is
v-mingqc@.microsoft.com, you may send the file to me directly and I will
keep secure.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.
Friday, February 17, 2012
Dynamic SQL question
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '-'.
Code Snippet
create table #t (Val1 smallint, Val2 smallint )
go
DECLARE @.Diff as int;
set nocount on
insert into #t values(10, 15)
--Why does this work?
SET @.Diff=(SELECT Val2 FROM #t) - (SELECT Val1 FROM #t)
select @.Diff
--And yet this does not?
EXEC('(SELECT Val2 FROM #t) - (SELECT Val1 FROM #t)')
drop table #t
go
Thanks
Colin
It is because you dont have a SELECT or anything in your dynamic sql.
change to:
Code Snippet
EXEC('SELECT (SELECT Val2 FROM #t) - (SELECT Val1 FROM #t)')and it works fine.
dynamic sql query syntax
I need ur help with syntax of following dynamic sql.actually it is simple version of what am doing but i know for sure this line actually causing the error.
DECLARE @.p_taskentrydtfilter nvarchar(50),@.taskentrydttag nvarchar(100)
declare @.p_taskentrydt DATETIME
set @.p_taskentrydtfilter= '>='
set @.p_taskentrydt = '20050609'
select @.taskentrydttag=case when (@.p_taskentrydt='' OR @.p_taskentrydt is null) then '' else
' and task.entrydt '+
@.p_taskentrydtfilter+''+@.p_taskentrydt+''' and task.entrydt <'''+dateadd(d,1,@.p_taskentrydt)+'' end
as u can see am storing a CASE stmt in a variable but it gives me error saying
"Syntax error converting datetime from character string."
any ideas .Thanks
Cheers
Hi,
I think its your date format. try setting your @.p_taskentrydt to other date date formats such as mm/dd/yyyy
cheers,
Paul June A. Domag
|||@.p_taskentrydtfilter+''+@.p_taskentrydt + '''should be:
@.p_taskentrydtfilter+''''+@.p_taskentrydt + '''
But you should be using sp_executesql instead of dynamically concatenating variables that can be set by caller for example. See BOL for more details on how to use sp_executesql to execute parameterized SQL statements.
|||Thanks Umachandar
That worked nicely