Friday, March 30, 2012

Report parameter validation from report manager in reporting services 2005

Hi,

Whenever user viewing a report using report manager,

how can we validate the input values from user for a datatime type report parameter.

i.e. validating whether the date is correct and in required format.

Thanks in Advance.

Regards

Pintu

The built in parameter UI performs only simple validation (making sure a float parameter has numeric characters, for example). The server will perform a full validation on the parameter value for formatting, culture, data type, etc. If you want more advanced client side validation, you will need to provide custom parameter UI in your own portal. Report Manager is not extensible in this regard.|||

Thanks Brian for providing the useful informaion

|||

Isn't there any built in functionality to prevent SQL injection? Or any build in functionality to prevent other scripts from being inserted i.e. scripts to prevent < > characters etc?

Can you provide a sample of a simple custom UI and tell us where/how to call it?

Thanks

Amy

Report parameter using Member_Key

I am trying to create a parameter driven SSRS report agains my cube but I want the parameter to contain only the Key value of the member I am trying to select. When I use the query designer, I get something like this:

SELECT ( STRTOSET(@.PlantStructureDepartment, CONSTRAINED)

Where @.PlantStructureDepartment is my paramter and contains the Unique Name of the member like this "[Plant Structure].[Department].&[39952]" where "39952" is the Key value.

What I want is to be able to pass the paramter in as "39952" and build the rest of the string. I tried this:

SELECT ( STRTOSET('[Plant Structure].[Department].&[' + @.PlantStructureDepartment + ']', CONSTRAINED)

but that didn't work.

The reason I'm trying to do this is that we are using SharePoint integrated filtering and we have a number of basic relational reports using the same filters as the reports against the cubes. We would like to keep them all using the integer values.

For sake of completeness, here is the full query as it sits right now:

SELECT NON EMPTY { [Measures].[FTT Percent] } ON COLUMNS, NON EMPTY { ([Plant Structure].[Prod Line].[Prod Line].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( STRTOSET(@.PlantStructureDepartment, CONSTRAINED) ) ON COLUMNS FROM [FTT]) WHERE ( IIF( STRTOSET(@.PlantStructureDepartment, CONSTRAINED).Count = 1, STRTOSET(@.PlantStructureDepartment, CONSTRAINED), [Plant Structure].[Department].currentmember ) ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

I am fairly new to MDX and would appreciate any help or suggestions.

Here is a copy of the query modified to use Adventure Works but illustrating what you requested. Where I've used '1', you would use your report parameter value.

Hope that helps,
Bryan

Code Snippet

SELECT

NON EMPTY { [Measures].[Reseller Sales Amount] } ON COLUMNS,

NON EMPTY { ([Product].[SubCategory].[SubCategory].ALLMEMBERS ) }

DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS

FROM (

SELECT ( STRTOSET('[Product].[Category].&['+'1'+']', CONSTRAINED) ) ON COLUMNS

FROM [Adventure Works])

WHERE (

IIF( STRTOSET('[Product].[Category].&['+'1'+']', CONSTRAINED).Count = 1,

STRTOSET('[Product].[Category].&['+'1'+']', CONSTRAINED),

[Product].[Category].currentmember

)

)

CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

|||

Bryan,

Thanks for the reply. I think you are stating the same thing that I tried already. When I hardcode the value as you suggest, the query works. However, when I set up the parameter, I get this message:

Parser: The query contains the Department parameter, which is not declared. (msmgdsrv)


This is because the paramter isn't declared in the data tab of the report. When I declare the parameter, I get this error:

Query (6, 23) The restrictions imposed by the CONSTRAINED flag in the STRTOSET function were violated. (Microsoft SQL Server 2005 Analysis Services)

The parameters page of the Data tab only allows you to tie a parameter to a dimension of the cube. I think I need a way around that.

Thanks again for the idea. If you have another, I'd appreciate it.

Chris

|||

The CONSTRAINED keyword is there to prevent an injection of a function call into the statement. While I think this is a good idea, I get the same error as you do when no injection is occuring. While I would recommend digging into the MDX statement a little deeper to understand the issue, I have in the past simply removed the CONSTRAINED keyword.

Not sure this is the best of ideas, but .....

Bryan

|||

That's what it was.

Thanks!

|||

You have CONSTRAINED in several areas, do you need to remove them all. Can you post your modified code?

Thanks,

Shari

|||I don't have access to my query right at the moment (I'm at a different location) but suffice it to say, I removed all of the CONSTRAINED flags and it worked. To the point made earlier, I'm not sure if it was a good idea, but it got me around the issue I was having.|||

I tried that, removing all the CONSTRAINED but got another error about STRTOSET function expects a tuple set, string was supplied .... . I am anxious to see your query if you could share (when you have access).

Thanks,

Shari

Report Parameter Toolbar

Good day everyone...

I created a simple report in SQL Server 2005 Reporting Services. Its about getting the sales from specific date and store. My parameters are date and storename, the report works fine as I view it in the reportserver. But, when we incorporate the report in a custom webpage using a reportviewer, the parameter toolbar occupies half the space, now that's my problem. Is there anyway I can create a custom Toolbar in Visual Studio so I can just set the parameter property to hidden so the default parameter toolbar wont show?

Thanks in advance guys... c",)

Yes. There's nothing extra (like controls) supplied to allow this. Just create the parameters using standard controls (dropdowns, dat pickers, whatever you like) and then in code pass those parameters to the report viewer control.sql

Report Parameter to return a "NULL" value

All
I am writing a report by salesperson and have the salespersons name as
a report Parameter however in the database it can return a NULL value
is the sale was genereated by someone other than the sales team. In
order for me to get the correct totals i need to include the NULL
value but if i select NULL it returns a blank report?
Any ideas?
cheersOn Jun 18, 3:38 am, blueboy <matt_me...@.hotmail.com> wrote:
> All
> I am writing a report by salesperson and have the salespersons name as
> a report Parameter however in the database it can return a NULL value
> is the sale was genereated by someone other than the sales team. In
> order for me to get the correct totals i need to include the NULL
> value but if i select NULL it returns a blank report?
> Any ideas?
> cheers
If I understand you correctly, have you tried using a value similar to
"Non Applicable" or some other descriptor that represents the null
value in the report parameter. That way, in the stored procedure/query
that is sourcing the report you can check for "...if @.SalesPerson ='Non Applicable' begin select * from table_x where salesperson is
null... end..." Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant

Report Parameter Selection aid fir user.

Hi,
Am curious, have a report paramater the user selects from a pull down
list that is smart enough to go to the record containing the first letter the
user types in. Is there any more intelligence we can add to this ? For
example expanding the record selection to perhaps two or three characters the
user types in.
Thanks, Steve.You can write your own custom toolbar using ASP.NET. However, you would
lose some interactive functionality like zoom.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"saustin99" <saustin99@.discussions.microsoft.com> wrote in message
news:BC425483-8FCB-4DD1-91FE-C1FF6535FC3F@.microsoft.com...
> Hi,
> Am curious, have a report paramater the user selects from a pull down
> list that is smart enough to go to the record containing the first letter
> the
> user types in. Is there any more intelligence we can add to this ? For
> example expanding the record selection to perhaps two or three characters
> the
> user types in.
> Thanks, Steve.|||Thanks for the reply Jeff ! Sounds like for this purpose it might be
overkill. Steve.
"Jeff A. Stucker" wrote:
> You can write your own custom toolbar using ASP.NET. However, you would
> lose some interactive functionality like zoom.
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "saustin99" <saustin99@.discussions.microsoft.com> wrote in message
> news:BC425483-8FCB-4DD1-91FE-C1FF6535FC3F@.microsoft.com...
> > Hi,
> > Am curious, have a report paramater the user selects from a pull down
> > list that is smart enough to go to the record containing the first letter
> > the
> > user types in. Is there any more intelligence we can add to this ? For
> > example expanding the record selection to perhaps two or three characters
> > the
> > user types in.
> >
> > Thanks, Steve.
>
>

Report parameter read only

Got this error message while trying to load a sub-report from an existing
report and passing a parameter into the sub-report. I created the report
parameter just like it did for the source report. Please help.That means you forgot to provide a Prompt for the parameter in the
subreport.
Omitting the Prompt indicates to the server that the user should not be
prompted for a value (hence: read-only).
--
My employer's lawyers require me to say:
"This posting is provided 'AS IS' with no warranties, and confers no
rights."
"John Cosmas" <vabo214@.msn.com> wrote in message
news:OKnfI3WZEHA.3228@.TK2MSFTNGP12.phx.gbl...
> Got this error message while trying to load a sub-report from an existing
> report and passing a parameter into the sub-report. I created the report
> parameter just like it did for the source report. Please help.
>

Report parameter question

Hi there,

I am a tad confused with an exception that I get whet trying to render

a report to pdf. I pass 2 arraylists which contains the name and value

of the parameters. I iterate through these lists (which are of equal

lenght) and set the parameters. I am very new to this so I am sure that

I am doing something stupid somewhere in the code below:

' Create instance of save dialog and set default

' filename and filter

saveReportDialog = New SaveFileDialog

saveReportDialog.Filter = GetFilterString(pFormat)

saveReportDialog.FileName = pName


' Open the save file dialog

Dim dr As DialogResult = saveReportDialog.ShowDialog()


If dr = DialogResult.OK Then

Dim fileName As String = saveReportDialog.FileName


Dim historyID As String = Nothing

Dim deviceInfo As String = Nothing

Dim showHide As String = Nothing

Dim param() As ParameterValue = New

ParameterValue(pParameterValuesArrayList.Count) {}

Dim credentials As DataSourceCredentials() = Nothing

Dim results() As [Byte]

Dim encoding As String

Dim mimeType As String

Dim warnings As Warning() = Nothing

Dim reportHistoryParameters As ParameterValue() = Nothing

Dim streamIDs As String() = Nothing


'Iterate through the array of parameters and set the report parameters

Dim i As Integer

For i = 0 To pParameterValuesArrayList.Count - 1

param(i) = New ParameterValue

param(i).Name = pParameterNamesArrayList(i)

param(i).Value = pParameterValuesArrayList(i)

Next


'Exectute the report and save it into a file.

Try

results = rs.Render(ReportItem.Path, pFormat, historyID, deviceInfo,

param, credentials, showHide, encoding, mimeType,

reportHistoryParameters, warnings, streamIDs)


Dim stream As FileStream = File.OpenWrite(fileName)

stream.Write(results, 0, results.Length)

stream.Close()


Catch exception As Exception

HandleException(exception)

End Try

End If
when trying to execute the red line of code, I get the following error which confuses:

an exception has occured: The value of parameter 'Parameters' is not valid.

I don't even have a parameter called 'Parameters' . When debugging, I

have determined that the arraylists contain the values they are

supposed to so now I am in need of expertise of all you smart people

here :)

Thanks

MichaelWhat is the error message? Does the report seem to execute just fine when running it through the SSRS\reports website?|||Hi there,

The error I get is in the code... the message reads:

an exception has occured: The value of parameter 'Parameters' is not valid.

The report never opens from whithin my application but does work from the development environment.

The confusing thing is that the only parameter I have is called

"@.MemberID" and not "Parameters", so I don't know what this error

message means. I you look at the code I posted above, the exception is

thrown when I ty to render the report.

Regards

|||Hi, I feel it is necessary to say that I solved my own problem.

It was a more fundamental mistake. I have not converted the parameters

to be strings and thereby it was in invalid. What I did to solve this

problem was:

Dim i As Integer

For i = 0 To pParameterValuesArrayList.Count - 1

parameters(i) = New ParameterValue

parameters(i).Name = CStr(pParameterNamesArrayList(i))

parameters(i).Value = CStr(pParameterValuesArrayList(i))

Next

This worked fine :)