SSRS - Pass Multi Value Parameter with Available Values Option Enabled Through Querystring - asp.net

I have one Parameter on my report, that has multi value on.
And it's values came from a Dataset.
On my application, when I request a report, this parameter goes as an Querystring value. But when I use the multi value option, the parameter is not a single value anymore, but an "array" with multiple values (Of Couse).
REPORT?codArea=&codDiretoria=17&ultimaAlteracao=on&formato=PDF&codListaPrioridade=8&codListaPrioridade=13
Important Part:
(codListaPrioridade=8&codListaPrioridade = 13)
The issue, is the "Available Values" option. The Parameter having an Array as a value, don't have any of the "Available Values" and SSRS throw a error.
Important Part:
System.ServiceModel.FaultException: This report requires a default or user-defined value for the report parameter 'codListaPrioridade'. To run or subscribe to this report, you must provide a parameter value.
If i disable the "Available Values" option, i can send this "array" without any issue:
codArea=&codDiretoria=17&ultimaAlteracao=on&codListaPrioridade=9&codListaPrioridade=13&formato=PDF
Important Part:
(codListaPrioridade=9&codListaPrioridade=13)
="----> "& Join(Parameters!codListaPrioridade.Value, ",")
The trick is that I need create in this report, this parameter with "Available Values" enabled, but this parameter need to accept "Any" values (Because the Array that is coming on querystring).
The "Available Values" must be used to show which values are available only (Inside my application).
Inside SSRS, the parameter works fine, the issue only occurs when using this report in my application, sending the parameters values in a querystring.

The key part of the error is "This report requires a default or user defined value for the report parameter."
You don't need a default parameter. It sounds to me like your application is passing an invalid parameter value to the report. The reason it works when you disable the available values is because then it will accept ANY value at all.
Run the query that populates the available values and keep it open.
Set a breakpoint in your ASP.NET code just before it passes the values to the report server. Examine what those values are and make sure it isn't trying to pass anything that ISN'T in the list of available values you got from running the query.
If there is something different then that is the cause of your error. I can't remember off the top of my head if casing matters so you'll want to check that too. And if you check them and everything is fine... check them again. I don't know how many times I've thought there wasn't any data out of place only to suddenly see it later.
An alternate theory would be that you just aren't passing the multi-value parameter to the report server correctly. I've never tried to do it directly in the URL before but on the MSDN page Pass a Report Parameter Within a URL in the "other examples" section it shows passing a multi-value parameter. In their example they seem to append a number to the end of the parameter name for each value. But I'm not sure if that is right either.
https://myserver/Reportserver?/SQL+Server+User+Education+Team/_ContentTeams/folder123/team+project+report&teamgrouping2=xgroup&teamgrouping1=ygroup&OrderID=747&OrderID=787&OrderID=12
But since you're already writing .NET code let me make a suggestion. Use the webservice as a webservice. It makes things like this so much easier. You just add the web service as a reference to the project and then basically call it like any other .NET class. The reference reads the WSDL file and shows you all of the available API calls and their parameters and what you'll get back. It really is quite a nice feature. Check out this MSDN article on "How to: Add a Reference to a Web Service" and then this TechNet dev guide: https://technet.microsoft.com/en-us/library/bb522713.aspx

Related

How to exclude imported URL parameters when they have no value?

I've installed the Swagger Importer, which is just great. It saved a lot of setup time. It also enumerated all of our APIs optional parameters, which is also good because I don't have to reference docs; however, I don't want GET and POST requests to send the params when I haven't explicitly set the values. Is there a way to configure PAW to not send URL Params when they have no value? One option is to just duplicate an item and then prune the list, but it seems reasonable that there should be a way to simply ignore items that aren't set.
For example:
Don't GET:
http://domain.com/api/v1/users?maxResultCount=&isActive=true
(because maxResultCount is optional and not set)
Instead, do GET:
http://domain.com/api/v1/users?isActive=true
The current release, Paw Version 3.0.7 (Retail) now provides checkboxes on URL parameters.

Extract part of an URL behind a login page with Paw

I'm a newbie but I think Paw can do what i need :
I need to extract a session id behind a login page.
I go to https://admin.booking.com, filling the form (login and pass) and the landing page behind includes a session id :
https://admin.booking.com/pc/index.html?ses=xxxxyyyyyzzzzz11112222233333
I'd like to :
1) Push credentials with Paw as part of my request,
2) get the above item (ses) item as a response so i can use the php script extension provided by Paw and then call this script "on demand".
Is this possible ? If so, what should i do ?
Thanks for your help
UPDATE*: we've added a documentation article to describe the process a little more: Login via a web form in Paw. We've detailed the process to deal with CSRF tokens too.
Paw isn't quite yet ready for handling web/HTML forms. Though, there's one way to do it the right way: if you inspect the form with the Chrome dev tools you'll find the name of the input from the DOM/HTML:
In your case, you have the inputs: loginname, password, lang.
Also, find the <form…> tag to see what's the action attribute. If there's no action attribute (like in your example), it means the target URL for your form is the current page's URL (https://admin.booking.com/ in your case). Also, make sure the method="POST" is also there in the <form…> tag, otherwise this method won't work.
Then jump into Paw and set:
URL (in your case https://admin.booking.com/)
method to POST
go to the Body tab and use "Form URL-Encoded + fill up the fields from your form
If all works, you'll see Paw show a redirection request, and if you go to the right-hand side panel under "Response" > "Headers", you should see a Location header with a value similar to the URL you initially mentioned (https://admin.booking.com/pc/index.html?ses=xxxxyyyyyzzzzz11112222233333). Hurray! You got your value into Paw!
Now that you have that, you can create in a new request (click on the + button at the bottom of the left-hand side list). And wherever you want to use this session token/ID, you can insert a dynamic value to retrieve that URL value. You have more infos here, in our docs, but I'll describe the steps here:
On whichever field you want to insert the token, right-click and pick Responses > Response Header.
Make sure you pick the first request in the "Request" dropdown menu, and enter Location in the "Header" field:
You should see the value of the Location header of the previous response appear here.
Now what you want to do is to extract only the part you want (i.e. the value of the ses param in your case). For that you'll need that extension for Paw, so please install it now: https://luckymarmot.com/paw/extensions/RegExMatch
Copy the dynamic value you have just inserted (the blue token), and right-click on that field to insert a new dynamic value, and pick Extensions > RegExp match:
In the Input field, paste the previous dynamic value you copied. And use the RegExp field to write a regular expression that will successfully extract the part of the URL you want (this should work in your case ses=(.*)).
Now that you're set up. You should be able to use this little new blue token wherever you like and automagically extract the value from the previous form. And whenever you send again the initial request, and get a new token, everything else will also update! :)
It was a little long guide, but I hope this will help you and hopefully others too.

JMeter "forgets" variable value defined via Regular Expressioin Extractor

I did create a simple testcase in JMeter.
Open a form and all it's content (css, images etc) :
GET /
GET /css/site.css
GET /favicon.ico
GET /fonts/specific-fonts.woff
GET /images/banner.png
Wait a little...
Post the values
POST /
Receive the "Thank You" page.
- GET /thanks
In the response on the first GET is a hidden input field which contains a token. This token needs to be included in the POST as well.
Now I use the "Regular Expression Extractor" of JMeter to get the token from the response. So far, so good.
Then, after retreiving all the other contents I create the POST message, using the variable name in the RegExp-Extractor in the value field of the token parameter.
But... when executing the testcase it fills in the default value given and not the actual value of the token.
So... first step in debugging this issue was to add a dummy-HTTP-GET request directly after I get the token. In this GET request I also add the token parameter with the token variable as value, but now I can easily check the parameter by looking at the access-log on my webserver.
In this case... the URL looks promising. It contains the actual token value in the GET, but it still uses the default value in the POST.
Second step in debugging was to use the "Debug Sampler" and the "View Results Tree".
By moving the Debug Sampler between the different steps I found out the value of the token-variable is back to the default value after I receive the CSS.
So... now the big question is...
How can I make JMeter to remember my variable value until the end of my test-script ?
JMeter doesn't "forget" variables. However variables scope is limited to the current Thread Group. You can convert JMeter variable to JMeter Property which have "global" scope by i.e. using Beanshell Post Processor with the following code:
props.put("myVar", vars.get("myVar"));
Or by using __setProperty() function. See How to Use Variables in Different Thread Groups guide for details.
As you found it your problem comes from a misunderstanding of scoping rules in jmeter.
https://jmeter.apache.org/usermanual/test_plan.html#scoping_rules
In your case, just put the post processor of the request that will give you the response containing the child node.
Also I think you don't need to share this token with other threads so don't use properties as proposed in the alternate answer.

ASP.NET ReportViewer Parameter Prompt doesn't show

I've been looking for this answer for a couple days now and I've been getting little bits of information that make it seem that you can have ReportViewer Control automatically prompt for the report's parameters. Just everything that I've tried and found doesn't seem to work. I've gotten the Parameter Prompts to work on a Windows Form but I just cannot get it to work in ASP.NET
I guess I'm simply asking can you get Report-viewer's Parameter Prompts to work in ASP.NET? if so, How?
I know you can do it manually, it's just, I feel if you can make ReportViewer Prompt automatically why program it yourself?
Edit: this is for local processing btw.
Prompting for parameters is not supported in local processing mode.
In article Report Parameters Dialog Box (Visual Studio Report Designer), which is invoked by clicking the Help button on that dialog, it says in the introductory text that:
The parameters properties that you specify in the Report Parameters
dialog box become part of the report definition. Some properties are
intended for programmatic use only. In contrast with reports that are
processed on a remote report server, a locally processed report does
not have a parameter input area used for selecting or typing parameter
values.
A little testing shows me that the default values specified for the parameters will be used, unless you modify them programmatically. I could not find an explanation on this design decision. If you want to use local processing, and prompt for user input, I would recommend to follow this solution:
I you embed the reports in a ReportViewer Control, you can put it on a page or form and add custom input controls to that page or form to gather report parameters. In the code-behind files, you will then pass the parameter values using code like this:
List<ReportParameter> parameterList = new List<ReportParameter>();
List<string> selectedProductTypes = listboxProductTypes.GetSelectedValues();
ReportParameter productTypes = new ReportParameter("ProductTypes", selectedProductTypes.ToArray(), false);
ReportParameter username = new ReportParameter("Username", "<current user>", false);
parameterList.Add(productTypes);
parameterList.Add(username);
reportViewer.LocalReport.SetParameters(parameterList);
In this example, you can see how to pass a multi-valued parameter, the values of which are taken from a multi-select ListBox.
You can also create a page that has the controls to gather the parameter input, put them in a set session variables and then transfer to the page that has the report viewer.
use object data source and set the parameter source as Session.
The only code you need to write is filling the session variables.

ognl.MethodFailedException "setCreatedDate" failed for object com.security.data.PasswordHistory#d5b561

i am using strut2.1.6 with tomcat 5.5
i have a Date field createDate in my PasswordHistory Bean, and corresponding date component on my "search.jsp" this field is optional - no validation required .
if i submit the form i am get the follwoing error on console
ognl.MethodFailedException: Method "setCreatedDate" failed for object com.security.data.PasswordHistory#d5b561 [java.lang.NoSuchMethodException: setCreatedDate([Ljava.lang.String;)] –
it looks that it is trying to convert the empty string to date, when it fails it tries to search the corresponding String argument method and if it converts the value to date successfully it calls the corresponding Date argument method – Muhammad Shahid
i want to avoid any conversion if the field is emtpy.
Do you have struts.devMode = true in struts.xml? From the docs:
And thirdly, perhaps the setting which is less widely known, and therefore a source of much confusion: it will raise the level of debug or normally ignorable problems to errors. For example: when you submit a field which cannot be set on an action 'someUnknownField', it will normally be ignored. However, when you're in development mode, an exception will be thrown, telling you an invalid field was submitted. This is very useful for debugging or testing large forms, but can also be confusing if you're relying on parameters in your request that are not set on the action, but which you are using directly in your view layer (warning: bad practice, you should always validate input from the web).
http://struts.apache.org/2.1.6/docs/devmode.html

Resources