Monday, March 26, 2012
how to show and edit parameters in a windows form
Datagrid) to extract parameters of an specific report and let user edit
them?
I 've done the exctracting the parameters ,,but I don't know how to extract
each parameter values(which are based on the different queries) and show it
to the user.
Thanks for your help.
ALISee the Report Wizard demo code in the AwReporterWin WinForm app that
accompanies my book source code.
http://www.manning-sandbox.com/thread.jspa?threadID=10393&tstart=45
--
Hope this helps.
---
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---
"ALI-R" <newbie@.microsoft.com> wrote in message
news:eqEm5q1yEHA.2624@.TK2MSFTNGP11.phx.gbl...
> Is there somebody who has used a windows form and a suitable control (Like
> Datagrid) to extract parameters of an specific report and let user edit
> them?
> I 've done the exctracting the parameters ,,but I don't know how to
extract
> each parameter values(which are based on the different queries) and show
it
> to the user.
> Thanks for your help.
> ALI
>|||Thank you very much indeed,,I was actually doing the same thing ,but it
helped a lot.
"Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com> wrote in message
news:%23rF5hT4yEHA.2788@.TK2MSFTNGP15.phx.gbl...
> See the Report Wizard demo code in the AwReporterWin WinForm app that
> accompanies my book source code.
> http://www.manning-sandbox.com/thread.jspa?threadID=10393&tstart=45
> --
> Hope this helps.
> ---
> Teo Lachev, MVP [SQL Server], MCSD, MCT
> Author: "Microsoft Reporting Services in Action"
> Publisher website: http://www.manning.com/lachev
> Buy it from Amazon.com: http://shrinkster.com/eq
> Home page and blog: http://www.prologika.com/
> ---
> "ALI-R" <newbie@.microsoft.com> wrote in message
> news:eqEm5q1yEHA.2624@.TK2MSFTNGP11.phx.gbl...
> > Is there somebody who has used a windows form and a suitable control
(Like
> > Datagrid) to extract parameters of an specific report and let user edit
> > them?
> >
> > I 've done the exctracting the parameters ,,but I don't know how to
> extract
> > each parameter values(which are based on the different queries) and show
> it
> > to the user.
> >
> > Thanks for your help.
> > ALI
> >
> >
>
Monday, March 12, 2012
How to set the parameter's default value dynamically?
Hi all,
Does anybody know how to set the parameter's default value dynamically?
I'm working on a report with some parameters against datacube, and I hope the default value of one of the parameters could be set dynamically based on the user's login.
Thanks,
Jone
Jone,
In your Report Parameter - Default Values - Non-Queries you can place an expression like so:
=IIf(User!UserID = "Bob", "USA","Canada")
I hope this is what you were looking for.
Ham
How to set the following report Parameters?
Hi,
I have a report and the parameters Passed to the report are Cusip and PeriodId through a stored Procedure.
i want to populate the cusip Parameters using a dataset thats got by a sproc called usp_getCusips.
and the PerioId using a dataset thats been got by another sproc called usp_Getperiods...
So in my report i have added 3 datasets one for the main report, one to get the values of the PeriodId and other to get the value of the cusip.
So in my Report parameters for the Parameter Cusip and i have checked the Available value option and selected its corresponding Dataset and value .
and i have also done the same thing for the PeriodId.. But when i run my sproc i am getting this Error.
[rsInvalidReportParameterDependency] The report parameter ‘Cusip’ has a DefaultValue or a ValidValue that depends on the report parameter “Cusip”. Forward dependencies are not valid.
[rsInvalidReportParameterDependency] The report parameter ‘PeriodId’ has a DefaultValue or a ValidValue that depends on the report parameter “PeriodId”. Forward dependencies are not valid.
Any Help will be appreciated.
Regards,
Karen
I'm not sure how to directly answer your question, but it sounds like you have created a circular reference.
See the following thread.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=184243&SiteID=1
|||
Greg,
Thanks for the help, i got it to work.
Regards
Karen
|||Glad I could help.
Friday, March 9, 2012
How to set Parameters with ExecutionService?
Hello, I havent been able to set parameters with the reportexecutionservice.
I also need to send a multivalue parameter, any ideas?
ExecutionInfo execInfo;
execInfo = rs.LoadReport(path, null);
ReportParameter pEmpresa = new ReportParameter()
pEmpresa = (ReportParameter)DropDownList1.SelectedValue;
execInfo.Parameters[0] = pEmpresa;
execInfo.Parameters[1] = DropDownList2.SelectedValue;
//rs.SetExecutionParameters();
StringBuilder selectected = new StringBuilder();
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items.Selected)
{
selectected.Append(CheckBoxList1.SelectedValue);
selectected.Append(",");
}
}
execInfo.Parameters[2] = selectected;
But I have the following errors
Error 13 Cannot convert type 'string' to 'RSExecution.ReportParameter' C:\Inetpub\wwwroot\GescomDllo\Protected\01_Administradores\rpt_clasificacioncompetencias.aspx.cs 550 20 http://localhost/GescomDllo/
Error 14 Cannot implicitly convert type 'string' to 'RSExecution.ReportParameter' C:\Inetpub\wwwroot\GescomDllo\Protected\01_Administradores\rpt_clasificacioncompetencias.aspx.cs 553 34 http://localhost/GescomDllo/
Error 15 Cannot implicitly convert type 'System.Text.StringBuilder' to 'RSExecution.ReportParameter' C:\Inetpub\wwwroot\GescomDllo\Protected\01_Administradores\rpt_clasificacioncompetencias.aspx.cs 568 34 http://localhost/GescomDllo/
I solved it a little , but I am still having problems with multivalue parameters
ExecutionInfo execInfo;
execInfo = rs.LoadReport(path, null);
ParameterValue pNmEmpresa= new ParameterValue();
pNmEmpresa.Name = "NmEmpresa";
pNmEmpresa.Value = DropDownList1.SelectedValue;
ParameterValue pNmCiclo = new ParameterValue();
pNmCiclo.Name = "NmCiclo";
pNmCiclo.Value = DropDownList2.SelectedValue;
////rs.SetExecutionParameters();
StringBuilder selectected = new StringBuilder();
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items.Selected)
{
selectected.Append(CheckBoxList1.SelectedValue);
selectected.Append(",");
}
}
ParameterValue pNmTiposCompetencia = new ParameterValue();
//pNmTiposCompetencia.Name = "NmTipoCompetencia";
//pNmTiposCompetencia.Value = "12";
string[] nmtiposcompetencia = selectected.ToString().Split(new char[] { ',' });
for (int i=0; i <= nmtiposcompetencia.Length ; i++)
{
pNmTiposCompetencia.Name = "NmTipoCompetencia";
pNmTiposCompetencia.Value = nmtiposcompetencia
;
//pNmTiposCompetencia.Value = "12";
}
ParameterValue[] parametros = new ParameterValue[3]{pNmEmpresa,pNmCiclo,pNmTiposCompetencia};
rs.SetExecutionParameters(parametros, null);
|||Almost done, I hardcoded the parameters and I saw that each value selected in the checkboxlist is a parameter, so thats a problem because I cant know the number of parameters
I am trying something like this with no luck yet,
I hope somebody to give me a hand.
The 2 constant is because I already know to parameters that come from two different dropdownlist.
StringBuilder selectected = new StringBuilder();
int TiposCompetenciasSeleccionadas = 0;
ArrayList al = new ArrayList();
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items.Selected)
{
selectected.Append(CheckBoxList1.SelectedValue);
selectected.Append(",");
al.Add(CheckBoxList1.SelectedValue);
TiposCompetenciasSeleccionadas++;
}
}
ParameterValue[] parametros = new ParameterValue[2 + TiposCompetenciasSeleccionadas] { pNmEmpresa, pNmCiclo };
for (int i = 0; i < parametros.Length; i++)
{
parametros[i+2].Name ="NmTipoCompetencia";
parametros[i+2].Value = al;
}
string[] nmtiposcompetencia = selectected.ToString().Split(new char[] { ',' });
rs.SetExecutionParameters(parametros, null);
Sunday, February 19, 2012
How to set a default value for a parameter - Fromperiod 7 ToPeriod from script
is actually a parameter for a dimension calendarYearMonth.
The default value of ToPeriod I want is 2006009 for the current month
which is Sept 2006 and I want FromPeriod to be 2005009 which is current
date - 365.
I want the default value to be derived from the current system date and
assign the current year and current month concatenated together to
FromPeriod & ToPeriod
Appreciate if you could kindly share the approach to implement this.
Thanks
KarenCreate a new dataset which can either select the current system date using
getDate() or can calculate the full text string you are after based on
getDate().
In the parameters window reached through the report menu, set the default
value to derive from query and reference the new dataset there.
Hope that helped.
"KarenM" wrote:
> I have two parameters called FromPeriod & ToPeriod of type String. It
> is actually a parameter for a dimension calendarYearMonth.
> The default value of ToPeriod I want is 2006009 for the current month
> which is Sept 2006 and I want FromPeriod to be 2005009 which is current
> date - 365.
> I want the default value to be derived from the current system date and
> assign the current year and current month concatenated together to
> FromPeriod & ToPeriod
> Appreciate if you could kindly share the approach to implement this.
> Thanks
> Karen
>
How to send parameters to report when executing ReportingService.Render
I'm trying to figure out how you send/set the report variables when using the ReportingService.Render method.
I can get the ReportParameters array using GetReportParameters but can't seem to find a way to populate the ParameterValue array that is passed as a variable in the Render method. I've tried creating an ArrayList comprised of ParameterValue objects (non-array), adding them to the ArrayList, and trying to convert that to a ParameterValue array. The example code I found is in VB.NET and looks like this:
reportParametersArray = rs.GetReportParameters(reportPath, Nothing, True, _
reportParameterValuesArrayList.ToArray(GetType(ParameterValue)), Nothing)
I tried to do the same thing in C#:
rpReportParams = rsReports.GetReportParameters(sReportPath, null, true, arrayListParams.ToArray(System.Type.GetType(ParameterValue)), dscCredentials);
The compile error is :
'ReportService.ParameterValue' denotes a 'class' where a 'variable' was expected
Putting quotes around ParameterValue returns the following error:
Argument '4': cannot convert from 'System.Array' to 'ParameterValue[]'
Anyone had success populating report parameters or have a suggestion?
Thanks,
O.
If arrayListParams is an ArrayList that contains ParameterValue objects, try this in C#(ParameterValue[])arrayListParams.ToArray(typeof(ParameterValue))