Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Monday, March 19, 2012

Inter-depending parameters

Hello all,
If I want to create a report where there're 3 parameters A, B, C.
While the list of displayed items of A depends on selected value on B & C.
list of displayed items of B depends on selected value on A.
list of displayed items of C depends on selected value on A also.
Is this possible?Sounds to me like you've got a circular dependancy.
If parameters B + C were governed from the selection in the A parameter then fair enough.
If the A parameter were governed from the selection in the B & C parameters then it would also be fair enough.
From what I can gather, you're suggesting that A is governed by B & C but then B & C is also then governed by A. This constanting updating of parameter lists may result in a report never actually getting run as the dependancy is cyclic.
I'd have a re-think about the logic involved and see if this is a clear picture of the situation as i'm a little confused.
DF
"Tnek" wrote:
> Hello all,
> If I want to create a report where there're 3 parameters A, B, C.
> While the list of displayed items of A depends on selected value on B & C.
> list of displayed items of B depends on selected value on A.
> list of displayed items of C depends on selected value on A also.
> Is this possible?

Interactive sorting in matrix

How could I accomplish interactive sorting inside the matrix control? I have matrix like this:

=Fields!Time_Calculations.Value (Current, Prior Year)
Forecast Sale
=Fields!Month xxxxx xxx

And I need to sort by Forecast and Sale.

Thnaks

The matrix region is somewhat special when it comes to sorting due to the way it aggregates data. In short, you need to use the corner textbox to set up your user sort, as this report definition demonstrates.

<?xml version="1.0" encoding="utf-8"?>

<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

<DataSources>

<DataSource Name="northwind">

<ConnectionProperties>

<IntegratedSecurity>true</IntegratedSecurity>

<ConnectString>Data Source=localhost;Initial Catalog=Northwind</ConnectString>

<DataProvider>SQL</DataProvider>

</ConnectionProperties>

<rd:DataSourceID>66a72cd8-749c-4971-b5d6-05b2612a4d40</rd:DataSourceID>

</DataSource>

</DataSources>

<BottomMargin>1in</BottomMargin>

<RightMargin>1in</RightMargin>

<ReportParameters>

<ReportParameter Name="RowGroup">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>ProductName</Value>

</Values>

</DefaultValue>

<Prompt>RowGroup</Prompt>

<ValidValues>

<ParameterValues>

<ParameterValue>

<Value>ProductName</Value>

<Label>By Product Name</Label>

</ParameterValue>

<ParameterValue>

<Value>SupplierID</Value>

<Label>By Supplier ID</Label>

</ParameterValue>

<ParameterValue>

<Value>CategoryID</Value>

<Label>By Category ID</Label>

</ParameterValue>

</ParameterValues>

</ValidValues>

</ReportParameter>

<ReportParameter Name="ColumnGroup">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>ReorderLevel</Value>

</Values>

</DefaultValue>

<Prompt>ColumnGroup</Prompt>

<ValidValues>

<ParameterValues>

<ParameterValue>

<Value>ReorderLevel</Value>

<Label>By Reorder Level</Label>

</ParameterValue>

<ParameterValue>

<Value>UnitsInStock</Value>

<Label>By Stock</Label>

</ParameterValue>

<ParameterValue>

<Value>SupplierID</Value>

<Label>By Supplier ID</Label>

</ParameterValue>

</ParameterValues>

</ValidValues>

</ReportParameter>

</ReportParameters>

<rd:DrawGrid>true</rd:DrawGrid>

<InteractiveWidth>8.5in</InteractiveWidth>

<rd:SnapToGrid>true</rd:SnapToGrid>

<Body>

<ReportItems>

<Textbox Name="textbox3">

<Left>0.125in</Left>

<Top>0.375in</Top>

<ZIndex>2</ZIndex>

<Width>3in</Width>

<Style>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Height>0.25in</Height>

<Value>="Matrix columns " &amp; Parameters!ColumnGroup.Label</Value>

</Textbox>

<Textbox Name="textbox1">

<Left>0.125in</Left>

<Top>0.125in</Top>

<rd:DefaultName>textbox1</rd:DefaultName>

<ZIndex>1</ZIndex>

<Width>3in</Width>

<Style>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Height>0.25in</Height>

<Value>="Matrix rows " &amp; Parameters!RowGroup.Label</Value>

</Textbox>

<Matrix Name="matrix1">

<MatrixColumns>

<MatrixColumn>

<Width>1in</Width>

</MatrixColumn>

</MatrixColumns>

<Left>0.125in</Left>

<RowGroupings>

<RowGrouping>

<Width>2.125in</Width>

<DynamicRows>

<ReportItems>

<Textbox Name="CategoryID">

<rd:DefaultName>CategoryID</rd:DefaultName>

<ZIndex>1</ZIndex>

<Style>

<TextAlign>Right</TextAlign>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Value>=Fields(Parameters!RowGroup.Value).Value</Value>

</Textbox>

</ReportItems>

<Grouping Name="matrix1_RowGroup">

<GroupExpressions>

<GroupExpression>=Fields(Parameters!RowGroup.Value).Value</GroupExpression>

</GroupExpressions>

</Grouping>

</DynamicRows>

</RowGrouping>

</RowGroupings>

<ColumnGroupings>

<ColumnGrouping>

<DynamicColumns>

<ReportItems>

<Textbox Name="ReorderLevel">

<rd:DefaultName>ReorderLevel</rd:DefaultName>

<ZIndex>2</ZIndex>

<Style>

<TextAlign>Right</TextAlign>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Value>=Fields(Parameters!ColumnGroup.Value).Value</Value>

</Textbox>

</ReportItems>

<Sorting>

<SortBy>

<SortExpression>=Fields(Parameters!ColumnGroup.Value).Value</SortExpression>

<Direction>Ascending</Direction>

</SortBy>

</Sorting>

<Grouping Name="matrix1_ColumnGroup">

<GroupExpressions>

<GroupExpression>=Fields(Parameters!ColumnGroup.Value).Value</GroupExpression>

</GroupExpressions>

</Grouping>

</DynamicColumns>

<Height>0.25in</Height>

</ColumnGrouping>

</ColumnGroupings>

<DataSetName>DataSet1</DataSetName>

<Top>0.875in</Top>

<Width>3.125in</Width>

<Corner>

<ReportItems>

<Textbox Name="textbox4">

<rd:DefaultName>textbox4</rd:DefaultName>

<ZIndex>3</ZIndex>

<Style>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<UserSort>

<SortExpression>=Fields(Parameters!RowGroup.Value).Value</SortExpression>

<SortExpressionScope>matrix1_RowGroup</SortExpressionScope>

</UserSort>

<Value>Sort rows</Value>

</Textbox>

</ReportItems>

</Corner>

<Height>0.5in</Height>

<MatrixRows>

<MatrixRow>

<Height>0.25in</Height>

<MatrixCells>

<MatrixCell>

<ReportItems>

<Textbox Name="ProductID">

<rd:DefaultName>ProductID</rd:DefaultName>

<Style>

<TextAlign>Right</TextAlign>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Value>=Count(Fields!ProductID.Value)</Value>

</Textbox>

</ReportItems>

</MatrixCell>

</MatrixCells>

</MatrixRow>

</MatrixRows>

</Matrix>

</ReportItems>

<Height>2in</Height>

</Body>

<rd:ReportID>4614d21e-03f0-4b4b-8270-a40c31094d26</rd:ReportID>

<LeftMargin>1in</LeftMargin>

<DataSets>

<DataSet Name="DataSet1">

<Query>

<rd:UseGenericDesigner>true</rd:UseGenericDesigner>

<CommandText>select * from products</CommandText>

<DataSourceName>northwind</DataSourceName>

</Query>

<Fields>

<Field Name="ProductID">

<rd:TypeName>System.Int32</rd:TypeName>

<DataField>ProductID</DataField>

</Field>

<Field Name="ProductName">

<rd:TypeName>System.String</rd:TypeName>

<DataField>ProductName</DataField>

</Field>

<Field Name="SupplierID">

<rd:TypeName>System.Int32</rd:TypeName>

<DataField>SupplierID</DataField>

</Field>

<Field Name="CategoryID">

<rd:TypeName>System.Int32</rd:TypeName>

<DataField>CategoryID</DataField>

</Field>

<Field Name="QuantityPerUnit">

<rd:TypeName>System.String</rd:TypeName>

<DataField>QuantityPerUnit</DataField>

</Field>

<Field Name="UnitPrice">

<rd:TypeName>System.Decimal</rd:TypeName>

<DataField>UnitPrice</DataField>

</Field>

<Field Name="UnitsInStock">

<rd:TypeName>System.Int16</rd:TypeName>

<DataField>UnitsInStock</DataField>

</Field>

<Field Name="UnitsOnOrder">

<rd:TypeName>System.Int16</rd:TypeName>

<DataField>UnitsOnOrder</DataField>

</Field>

<Field Name="ReorderLevel">

<rd:TypeName>System.Int16</rd:TypeName>

<DataField>ReorderLevel</DataField>

</Field>

<Field Name="Discontinued">

<rd:TypeName>System.Boolean</rd:TypeName>

<DataField>Discontinued</DataField>

</Field>

</Fields>

</DataSet>

</DataSets>

<Width>3.375in</Width>

<InteractiveHeight>11in</InteractiveHeight>

<Language>en-US</Language>

<TopMargin>1in</TopMargin>

</Report>

Interactive sorting a list

Okay, I'm sure there is a way to do this. Basically what I have is a
List that contains a table. The list is grouping on a value so that
the table just shows some sub-details related to the grouping. What I
would like to do is sort the List. Here is an example of what I have
is the List grouping on the House Name (e.g. "My House"):
House Name:
My House
Rooms (table):
Bedroom 1 ...
Bedroom 2 ...
Living Room ...
House Name:
Bob's House
Rooms (table):
Bedroom 1 ...
Kitchen ...
So basically I want the user to be able to click on either "My House"
or "Bob's House" and change the list sort. Hope I'm making sense.
Thanks for any help!So I found one way to potentially accomplish this by setting up a
parameter, and then doing a "Jump to report" to reload the same
report, but changing the parameter that I use to control the sort of
the List. However, whenever I click on "My House" to cause the whole
jump to report thing to happen, I end up with the error "A data source
instance has not been supplied for the data source "House_Dataset"".
As some more info, this is all local processing, and I'm setting up
the data sources myself when the report is loaded for the first time
like so:
reportViewer1.LocalReport.ReportEmbeddedResource = "HouseInfo.rdlc";
reportViewer1.LocalReport.DataSources.Add(new
Microsoft.Reporting.WinForms.ReportDataSource("House_Dataset",
GetHouseDS()));
reportViewer1.LocalReport.DataSources.Add(new
Microsoft.Reporting.WinForms.ReportDataSource("Room_Dataset",
GetRooms()));
reportViewer1.RefreshReport();
So the initial load of the report is fine, but once the "jump to
report" executes, seems the reload loses (or never gets) the data
sources it needs.

Friday, March 9, 2012

Intensively used function in view needs a minimum and maximum from a table

I have a problem (who not?) with a function which i'm using in a view.
This function is a function which calculates a integer value of a
date. For example: '12/31/2004 00:00:00" becomes 20041231. This is
very handy in a datawarehouse and performes superfast. But here is my
problem.

My calendar table is limited by a couple of years. What happens is
that sometimes a value is loaded which is not in the range of the
Calendardate. What we want to do is when a date is loaded is that this
function insert a minimum date when date < minimum date and a maximum
date when date > maximum date.

Yes i know you're thinking : This is datamanipulation and yes this is
true. But now we loose information in our cubes and reports by inner
joining. So if we can use a minimum and a maximum than a user would
say: "This is strange, a lot of values on 1980/1/1!" instead of "I
think that i have not all the data!"

Greetz

HennieHi

If you LEFT or RIGHT JOIN to the calendar table you will get a NULL value
for the column, you can then is CASE to determine the value

CREATE FUNCTION ConvertDate (@.datevalue datetime)
RETURNS INT
AS
BEGIN
DECLARE @.dateint INT
SELECT @.dateint = CAST( CASE WHEN A.Date < '20030101' THEN '19800101'
WHEN A.Date > '20051231' THEN '99991231'
ELSE CONVERT(CHAR(4),C.[Year]) + RIGHT('0'+
CONVERT(VARCHAR(2),C.[Month]),2) + RIGHT('0'+ CONVERT(VARCHAR(2),C.[Day]),2)
END AS INT )
FROM ( SELECT @.datevalue AS [Date] ) A
LEFT JOIN CALENDAR C ON C.[Date] = A.[Date]
RETURN @.dateint
END
GO

John

"Hennie de Nooijer" <hdenooijer@.hotmail.com> wrote in message
news:191115aa.0412300238.7dee0f85@.posting.google.c om...
>I have a problem (who not?) with a function which i'm using in a view.
> This function is a function which calculates a integer value of a
> date. For example: '12/31/2004 00:00:00" becomes 20041231. This is
> very handy in a datawarehouse and performes superfast. But here is my
> problem.
> My calendar table is limited by a couple of years. What happens is
> that sometimes a value is loaded which is not in the range of the
> Calendardate. What we want to do is when a date is loaded is that this
> function insert a minimum date when date < minimum date and a maximum
> date when date > maximum date.
> Yes i know you're thinking : This is datamanipulation and yes this is
> true. But now we loose information in our cubes and reports by inner
> joining. So if we can use a minimum and a maximum than a user would
> say: "This is strange, a lot of values on 1980/1/1!" instead of "I
> think that i have not all the data!"
> Greetz
> Hennie|||On 30 Dec 2004 02:38:51 -0800, Hennie de Nooijer wrote:

>I have a problem (who not?) with a function which i'm using in a view.
>This function is a function which calculates a integer value of a
>date. For example: '12/31/2004 00:00:00" becomes 20041231. This is
>very handy in a datawarehouse and performes superfast. But here is my
>problem.
(snip)

Hi Hennie,

Is this conversion all that your function does? If so, you might want to
try the following alternative (using CURRENT_TIMESTAMP as example; replace
it with your date column / parameter):

SELECT CAST(CONVERT(varchar, CURRENT_TIMESTAMP, 112) AS int)

You could put this in the UDF (probably at least as fast as your current
Calenmdar-table based function), or use it inline as a replacement to the
function call (probably even faster).

It should work for all dates from Jan 1st 1753 through Dec 31st 9999.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)

Sunday, February 19, 2012

Integrating Rdl to webapplication with parameter passing

<p>

Hi,

i was created rdl and deployed it rdl is working fine and asked parameter prompt and i gave the value report is generated in rdl.

and i was Integrated to Reportviewer in my web application all things are ok.

But how to set the parameter in reportviewer.

could any one help to me.

regards

kumar

</p>

this is easy

First it is necessary to ccreate aReportParameter object (be sure you have a reference toMicrosoft.Reporting.WebForms).The contructor takes two string parameters one for the Name and one forthe Value. A new parameter would look like the code below.

ReportParameter myReportParameter = new ReportParameter("Id",
Request.QueryString["Id"]);

Next, parameters on the ReportViewer are set using theSetParameters method. It takes an array of ReportParameter, so you would have syntax like the following.

MyReportViewer.ServerReport.SetParameters(
new ReportParmeter[] { myReportParameter });

Integrating Rdl to webapplication with parameter passing

Hi,

i was created rdl and deployed it rdl is working fine and asked parameter prompt and i gave the value report is generated in rdl.

and i was Integrated to Reportviewer in my web application all things are ok.

But how to set the parameter in reportviewer.

could any one help to me.

regards

kumar

this is easy

First it is necessary to ccreate aReportParameter object (be sure you have a reference toMicrosoft.Reporting.WebForms).The contructor takes two string parameters one for the Name and one forthe Value. A new parameter would look like the code below.

ReportParameter myReportParameter = new ReportParameter("Id",
Request.QueryString["Id"]);

Next, parameters on the ReportViewer are set using theSetParameters method. It takes an array of ReportParameter, so you would have syntax like the following.

MyReportViewer.ServerReport.SetParameters(
new ReportParmeter[] { myReportParameter });

Integrating Rdl to webapplication with parameter passing

Hi,

i was created rdl and deployed it rdl is working fine and asked parameter prompt and i gave the value report is generated in rdl.

and i was Integrated to Reportviewer in my web application all things are ok.

But how to set the parameter in reportviewer.

could any one help to me.

regards

kumar

this is easy

First it is necessary to ccreate aReportParameter object (be sure you have a reference toMicrosoft.Reporting.WebForms).The contructor takes two string parameters one for the Name and one forthe Value. A new parameter would look like the code below.

ReportParameter myReportParameter = new ReportParameter("Id",
Request.QueryString["Id"]);

Next, parameters on the ReportViewer are set using theSetParameters method. It takes an array of ReportParameter, so you would have syntax like the following.

MyReportViewer.ServerReport.SetParameters(
new ReportParmeter[] { myReportParameter });

|||

Thanks lot Tamer Fathy you are nice and simply guide to me

It is working fine once again Thanks lot

regards

kumar

|||

Mr. Tamer,

How do I pass 2 or more parameters to Report ??

Thanks,

Kusno

|||

You welcomeSmile,

you can easily do this as the report parameters are list

ReportParameter(ReportParameterName, Value);

I.e.

string strTime = System.DateTime.Now.ToShortTimeString();

RptParameters[0] =
new Microsoft.Reporting.WebForms.ReportParameter("ReportParameterName",Value);
RptParameters[1]=
new Microsoft.Reporting.WebForms.ReportParameter("ReportParameterName",Value);

 
and so on 

|||

Yes, it works....Yes

Thanks a lot man.