Showing posts with label parameter. Show all posts
Showing posts with label parameter. Show all posts

Wednesday, March 28, 2012

How to Show Last Admit Date

I have a report that shows patient information, such as patient number, name, and admit date. It also has a date parameter. I enter in the date and it shows all the patients admitted that day. I would like to show the last date the patient was admitted before the date I ran the report for.

For example, if I run the report for 12/20/06, I want to see the patients that were admitted that day and their info like name, and patient number. I would also like to see the last date they were admitted.

Could you just do a subquery to get the max date for each patient from before the date parameter? Something like this:

select ...
(select max(admit_date) from patient_admittances pa where p.patient_id = pa.patient_id and admit_date < @.RunDate)
from patients p
inner join ...

Jarret

Monday, March 26, 2012

How to show all the fields in a dataset.

I have a sp that returns a different dataset depending on the parameter
values, it is dyanamic sp which has different field names and also the
number of fields.
Is there a way to incorporate this in reporting services, like in .Net
we can display the dataset by just binding it to the datagrid and
letting datagrid handle the rest.
Thanks,
TonyNo. RS does not work that way. It expects a consistent number/name of
fields.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<bubaa118@.yahoo.com> wrote in message
news:1107965810.679249.274270@.c13g2000cwb.googlegroups.com...
> I have a sp that returns a different dataset depending on the parameter
> values, it is dyanamic sp which has different field names and also the
> number of fields.
> Is there a way to incorporate this in reporting services, like in .Net
> we can display the dataset by just binding it to the datagrid and
> letting datagrid handle the rest.
> Thanks,
> Tony
>|||Thanks for the prompt reply Bruce, Is there any other workaround for
the issue I have any ideas or suggestions would be great.
Thanks again,
Tony|||You can have multiple datasets in a report, each of them calling the
procedure with the appropriate parameter. This does mean the SP will get
called multiple times. Then you should be able to hide the table on the
report if there is no data. I haven't tried this but I think you can. You
still might end up with some blank lines though.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<bubaa118@.yahoo.com> wrote in message
news:1107967055.899883.298640@.f14g2000cwb.googlegroups.com...
> Thanks for the prompt reply Bruce, Is there any other workaround for
> the issue I have any ideas or suggestions would be great.
> Thanks again,
> Tony
>|||You could also at the end of your proc pivot (or is this really
unpivoting) the data. So for a table with structure
# keycol # col1 # col2 # col3 # col4 # ... # col<n> #
you would end up with
# keycolvalue # colname # colvalue #
this will have n rows for each row in the original table. You may want
to modify your proc to build that to begin with rather than pivot data
later.
then you could drop that into a matrix.
This would work fairly well if all variable columns are of the same
type. Otherwise you'd have to do some formatting in the stored
procedure.

How to share parameter value between main and subreport?

Hi All,

I am really lousy when it comes to creating reports. So I am seeking your expert advise/experience.

I have a report that uses a stored-procedure as its data source. This procedure has a parameter. Within this report, I created a subreport which also sources to yet another stored-procedure that also has a parameter which expects the same value as the param of the main report.

When I run the report, say in preview mode, I do not want to be prompted with the parameter twice (i.e. once for the main report, and another for the subreport). How can I edit/modify subreport so that in its select or formula it will say something like:

{?@.ParamOfSubReport} = {?@.ParamOfMainReport}

Many thanks in advance.

_msd_You need to use shared variable and you can use it anywhere in the report|||Right click on your sub-report and choose "Change sub-report links".

Example:

"?parameter1" in the main report links to "?Pm-?parameter1" in the sub-report, then choose the field in the datasource that the parameter is tested against.

When you enter the parameter in your main report it will be passed to the sub-report preview also.|||How do I pass a value returned from the stored proc in the main report to the sub report. I'm getting an error "cannot link from stored procedure" when I pass the value from main report to subreport using subreport links.

Immediate response would be appreciated. Thanks.|||Assign value to shared variable and use that in Sub report|||Hi, I saw this old thread and I am working on the same issue. I'm working on a simple dumb shell of a report in Crystal 8.5 as a test for how to pass parameters into a sql server 2000 stored procedure via a subreport. I'd like to deliver this as straight Crystal without using vb or other shells to call the report from.

Eventually I need to modify a copy of a main report with data and about 8 subreports, all pulling from stored procedures using one parameter called ID. I am getting many requests for this ID parameter, for each subreport, even though I am linking the parameters via subreport links.

The subreport wants to link into the stored procedure using the parameter name from the stored procedure, which is @.ID. The main report only wants to give the subreport a subordinate link such as ?Pm-@.ID. I cannot name the stored procedure parameter with a name like ?Pm-@.ID because it violates the rules of transact-sql. It sees the hyphen as a subtraction. I can see the logic of using the same variable names, but how do I get rid of that bothersome hyphen?

I have also tried using shared variables and they connect to the subreport ok, but I'm still not closing the loop by linking into the stored procedure based on the shared variable.

I am trying to use the same information in multiple places without making the user enter the same information over and over again.

Has anyone had this problem before?sql

Monday, March 19, 2012

How to set this parameter AlwaysUseDefaultCodePath="TRUE"

Hello all,
I am trying to migrate date from Oracle 10g to SQL serve 2005 during the data transformation I get the following error

Messages

Warning 0x80202066: Source - SERVICE [1]: Cannot retrieve the column code page info from the OLE DB provider. If the component supports the "DefaultCodePage" property, the code page from that property will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page from the component's locale ID will be used.
(SQL Server Import and Export Wizard)

I searched internet and solution seems to be setting AlwaysUseDefaultCodePath="TRUE"

But where do you do this ?

I found this too: It's on the Properties tab of the OLE DB Source in Custom Properties section.

But still do not know where to go to set this parameter

Please help


The AlwaysUseDefaultCodePath property may be available in the Advanced Editor for the OLE DB Source. This editor has a Component Properties tab, and Input and Output Properties tab.

To open the Advanced Editor, right-click the OLE DB Source component in the package, and then click Advanced Editor.

|||For thi styoe of property I normally find it faster and easier to just use the Properties window in the designer, rather than opening the Editor. Select the component, and then hit F4 to bring the properties window into focus if it is not already.|||Thanks, Thats what I was looking for, it resolve my issue

How to set this parameter AlwaysUseDefaultCodePath="TRUE"

Hello all,
I am trying to migrate date from Oracle 10g to SQL serve 2005 during the data transformation I get the following error

Messages

Warning 0x80202066: Source - SERVICE [1]: Cannot retrieve the column code page info from the OLE DB provider. If the component supports the "DefaultCodePage" property, the code page from that property will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page from the component's locale ID will be used.
(SQL Server Import and Export Wizard)

I searched internet and solution seems to be setting AlwaysUseDefaultCodePath="TRUE"

But where do you do this ?

I found this too: It's on the Properties tab of the OLE DB Source in Custom Properties section.

But still do not know where to go to set this parameter

Please help


The AlwaysUseDefaultCodePath property may be available in the Advanced Editor for the OLE DB Source. This editor has a Component Properties tab, and Input and Output Properties tab.

To open the Advanced Editor, right-click the OLE DB Source component in the package, and then click Advanced Editor.

|||For thi styoe of property I normally find it faster and easier to just use the Properties window in the designer, rather than opening the Editor. Select the component, and then hit F4 to bring the properties window into focus if it is not already.|||Thanks, Thats what I was looking for, it resolve my issue

How to set this parameter AlwaysUseDefaultCodePath="TRUE"

Hello all,
I am trying to migrate date from Oracle 10g to SQL serve 2005 during the data transformation I get the following error

Messages

Warning 0x80202066: Source - SERVICE [1]: Cannot retrieve the column code page info from the OLE DB provider. If the component supports the "DefaultCodePage" property, the code page from that property will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page from the component's locale ID will be used.
(SQL Server Import and Export Wizard)

I searched internet and solution seems to be setting AlwaysUseDefaultCodePath="TRUE"

But where do you do this ?

I found this too: It's on the Properties tab of the OLE DB Source in Custom Properties section.

But still do not know where to go to set this parameter

Please help


The AlwaysUseDefaultCodePath property may be available in the Advanced Editor for the OLE DB Source. This editor has a Component Properties tab, and Input and Output Properties tab.

To open the Advanced Editor, right-click the OLE DB Source component in the package, and then click Advanced Editor.

|||For thi styoe of property I normally find it faster and easier to just use the Properties window in the designer, rather than opening the Editor. Select the component, and then hit F4 to bring the properties window into focus if it is not already.|||Thanks, Thats what I was looking for, it resolve my issue

How to set the width on the multi-select drop down (not the simple select)?

Hi,

How can I set the width on the multi-select parameter box? I checked the post about setting the SELECT, but that affects the single parameter box, not the multi-select.

I know there is an HtmlViewer.css file and have changed the rsReportServer.config file to use it, but I don't know what the tag is to set the width on the drop down parameter list box in the htmlViewer.css file. Or is it in another file?

Any ideas?

Thanks.

pl

The width of the MVP parameter box is not configurable sorry to say.

|||

Thank you for your response.

Is there any chance that the ability to set the width for the multi-select parameter box might be included in RS 2005 SP1?

Also, I read somewhere that the solution Report Manager is a project that is available as a download for Visual Studio 2005. If I were to download the project, could I set this feature up myself?

Thanks.

|||Has this bug been addressed in SP1. Users are gobsmacked when they hear that the size of the multi box cannot be set to the width of the widest entry.|||

This behavior will not changed in SP1. From our customers we have seen this as a good recommendation for the next release and it is on the list (with many other suggestions) as a possible feature improvement.

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 autofresh parameter through expression?

if the user chooses type=a
then the autofresh is true,eg.every 10secs.It should be something like this:
=iif(Parameters!type = "a", 10, 0)
This same pattern is used to write lots of expressions for conditional
formatting for instance in the FontWeight property for a textbox cell
you can place:
=iif(Value > 0, Bold,Normal)
This will bold all values greater than 0. Notice that you don't in
this case you can reference just value, but if you you wanted to base
it off another cell you would need to do something like this:
=iif(ReportItems!Textbox1.Value > 0, Bold,Normal)
Occasionally values such as colors have to be in quotes e.g. "Black".
Others such as FontWeight have constants associated with them.
Collections that can be accessed in this way are:
ReportItems
Globals
Parameters
Fields|||thanks a lot,
how to get all the collections that can be accessed?
i mean the specific parameter? e.g the auto refesh of the report?
can you show me some sites that are helpful for beginner?|||Except for ReportItems all of the collections are enumerated when you
go into the expression editor for a cell or property. For ReportItems
just click on the item to find out its name. If it has a nonspecific
name I recommend renaming it before you reference it.
I haven't been able to find any good sites. Books on reporting services
will give you a basic overview, but I haven't found any that go beyond
that. Most of what I have learned has been hacking it out trial and
error, patient googling for references to specific topics, and digging
around Microsoft's documentation, which is fairly spartan. This news
group is really one of the best sources of information, and
unfortunately I only found it a few days ago. I access it through
google groups(there are other ways, I recommend google). Google lets
you search just this news group for information. The group has been
around a while so queries for 'expression' or 'collection' turn up lots
of hits. Search the group first before posting a question.|||i also found the google group a few days ago, my mother language is not
english,so it is a little difficult for me to express my question
clearly,i really know that what i have asked is old,but patient
googling for referernces means costing much time,unfortunately i have
little time on that project.
i really apprecaite those who help me.thanks.

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.ItemsIdea.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.ItemsIdea.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++)

{

pNmTiposCompetenciaIdea.Name = "NmTipoCompetencia";

pNmTiposCompetenciaIdea.Value = nmtiposcompetenciaIdea;

//pNmTiposCompetencia.ValueIdea = "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.ItemsIdea.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 = alIdea;

}

string[] nmtiposcompetencia = selectected.ToString().Split(new char[] { ',' });

rs.SetExecutionParameters(parametros, null);

How to set PageBreakAtEnd of a Table

I use a Table in a report.
I have a parameter PageBreak in the report.
How can I set the PageBreakAtEnd property of a Table to the parameter?Ad,
In the properties of the table you can set this @. the general tab. V for a
pagebreak after this table.
Perry
"ad" <flying@.wfes.tcc.edu.tw> wrote in message
news:OgBGdYf1GHA.4388@.TK2MSFTNGP03.phx.gbl...
>I use a Table in a report.
> I have a parameter PageBreak in the report.
> How can I set the PageBreakAtEnd property of a Table to the parameter?
>

Friday, February 24, 2012

How to set default date

Hi Guys,

I have a time standard dimension used as a filter to my report.

How can I set the parameter to get the current month and year to be used by the time standard filter.

Select the report, and go to Report->Parameters, select the parameter, in the default values sectoin, set the value there. You can use function too, like get current date, use =Today, and DatePart() to get year, month, date, whatever.

How to set connection, Send Parameter and Filter data

Dear all .Netter,

I'm newbie in Reporting Services. I'm able to creating raw Reporting Services reports.

I have these questions to you all :

1. How to change connection to server and database when running in ASP.Net form. Currently in development PC, the server name is ServerA and the Database name is DatabaseA. After i copy to production server, the server name is ServerB and the database name is DatabaseB.

2. How to send parameter to Reporting Services report. I want to show name of user that print the report.

3. How to filter data that will be showed in the Reporting Services. I want to print Invoice with no : INV-2007-0001 and next INV-2007-0002

Sorry, if I'm lazy, but i'm running with time to replace Crystal Reports with Reporting Services.

Thanks and Regards,

Kusno.

These are some great links that will give you any answer you want

http://www.codeproject.com/sqlrs/AHCreatRepsAspNet.asp
http://msdn2.microsoft.com/en-us/library/ms170246.aspx
http://www.codeproject.com/sqlrs/ReportViewer2005.asp

Have FunSmile

Sunday, February 19, 2012

How to set a parameter for filtering not blank records

In my report I want an optional parameter to filter all records with a specific field that is not blank. I tried several scenario's without result...

In the parameter I want to set a text value like "exampletext".

In the filter I want a check: if the parameter value is "exampletext", only show the records where field "abc" is not blank.

On the tab Filters from the Table properties I can set three values: Expression, Operator and Value.

Please help!

I've found the solution.

Expression: =Iif(Parameters!Parameter.Value="exampletext",(Fields!Fieldname),"NULL")

Operator: >

Value: 0

How to set a parameter for filtering not blank records

In my report I want an optional parameter to filter all records with a specific field that is not blank. I tried several scenario's without result...

In the parameter I want to set a text value like "exampletext".

In the filter I want a check: if the parameter value is "exampletext", only show the records where field "abc" is not blank.

On the tab Filters from the Table properties I can set three values: Expression, Operator and Value.

Please help!

I've found the solution.

Expression: =Iif(Parameters!Parameter.Value="exampletext",(Fields!Fieldname),"NULL")

Operator: >

Value: 0

How to set a default value for a parameter - Fromperiod 7 ToPeriod from script

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
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
>