Pass parameters to report definition using activity. Pega8.6 - pega

I have created a report definition under -Data layer and I have set parameter there as a filter.
Now, I want to call this report under work layer and pass the parameter using activity.
How can I do that ?

Well best practice is to call that Report Definition through a parametrized Data Page if parameters are very few.
Any way you can still pass those parameters to any called Activity by using bellow steps.
Create one Property-Set method before calling report definition and set these parameters.
Param.pyReportName = "YourReportName"
Param.pyReportClass = "YourReportClass"
Param.pyPageName = "PageName"
Param.GradeParameter = "ValueOfGradeParameter"
Now call the report calling activity(your 6th step) with Pass current parameter page check box checked. By checking this check box you can pass all the parameters to the called Activity which you set in the main Activity.

Related

Access List of Parameters from Within an Action

I would like to be able to generically access a list\dictionary of parameters from within an action. I know its possible to do this from within an ActionFilter by using:
ActionExecutingContext.ActionDescriptor.Parameters
But, I can't figure out a way to access that same list from within the action itself.
Backstory:
The end goal is for all of my actions to call the same function. The function will accept a stored proc name, and a list of parameters, then execute the stored proc using the supplied parameters. I have created each action so that the actions parameters are the same name\type as the stored proc parameters. Using this setup, I want to be able to just send the list of parameters associated with the action to a single generic call.
I have tried using:
HttpContext.Request.Query
But, that won't work, because I could have some action parameters that aren't required and have a default, these don't show up in the http query, and I still need them to be passed into my generic function.
"ModelState" is what I was looking for, it has everything I need, including the default values of the parameters that weren't in the query string.

Can you set an Internal parameter using the Report Viewer control?

Is it possible to set an internal parameter value using the Report Viewer control?
rv.ServerReport.SetParameters(new ReportParameter[] { new ReportParameter("Username", User.Identity.Name) });
{"The report parameter 'Username' is read-only and cannot be modified.
(rsReadOnlyReportParameter)"}
I've heard that you can only set an internal parameter using the Report Viewer...but it seems an internal parameter is just that...internal. To be clear, an internal parameter on the server side is one where both Hide and Prompt are not checked on the parameter definition. If Hide is checked (hidden parameter), the parameter can still be passed in via a query string or on a subscription.
MSDN - Creating Report Parameters and Setting Report Parameter Properties:
Hidden and Internal Parameters
You can set options that control parameter visibility in the published
report. Setting the Hidden and Internal options provides different
levels of visibility. You can hide the parameter on the parameter
input area of the published report, yet set values for it on a report
URL or in a subscription definition. If you set a parameter to
Internal, it is not exposed in any way except in the report
definition. An internal parameter must have a default value, which can
be null if the Allow null value option has been selected.
Update, after a bit of testing:
This is actually a confusing definition. The parameter is exposed in Report Viewer and the value can be easily overridden in the report properties and the properties of a linked report.
You are still unable to set the value of an internal parameter from the URL or from the drill-down action from another report. It is visible when you create the action but when you try to drill-down you get the error: The report parameter 'name' is read-only and cannot be modified. I wouldn't imagine you will be able to modify the value from code either, but I haven't tested that.
I had the same issue. I was sending to SSRS by URL some parameters. I needed to validate/edit the parameter if contains certain character. something like that:
=IIF(Parameters!Par1.Value Like "*]","[Table1].[Field1].&[" + Parameters!Par1.Value + "]]","[Table1].[Field1].&[" + Parameters!Par1.Value + "]")
In the Parameter Definitions. in "Select Parameter Visibility" I had marked the option: "Internal". I changed to "Hidden" and it allowed me to edit the parameter. why? no clues. but now is working

Workflow: Trying to pass an object variable to a class method

I am having a tough time trying to pass a parameter into my method when I go to invoke it.
I new up a variable called setupNewCase, then I populate it with data. Once I do that, I then try to invoke the method. It normally works when I don't have a value to pass into it, but it doesn't work here in this case as I am trying to pass something into it.
To pass parameters to the invoked method you use the Parameters property on the InvokeMethod activity. Its available on the activity's properties grid and not directly on the designer.
You would use TargetObject when invoking a method on an instance object but since your CommonMethods class is static you won't ever instantiate it and therefore TargetObject should be empty.

How to get the form name in class?

I have a form which is used for automatic journal postings.
On that form I have a Ok command button and in closeOk method of the form I call the method from my datasource table.
In the JournalCheckPost class's infoResult() method I want to determine if the method is called from my form. I know that it can be done with caller methods but I don't know how exactly it should be done technically.
It is bad practice to make a method depend on where it is called from.
What you can do is to pass an extra parameter to the LedgerJournalCheckPost and infoResult can then check that. This can be done by introducing a boolean flag and a parm method.
I think, there can be many situations:
You want to pass some parameters from form
You want to manipulate the form (for example refresh datasource after action is complete)
Something other
But in all the cases depending on particular form is not a very good idea.
In first case you can set parameters from code using parm methods, or, better pass parameters using the Args class
In the second you can cast Args.caller to some interface that contain all the methods you want and manipulate the form using that methods (see \Classes\SysFormRun_doRe usages for example)

Printing the custom testcase name in the report using testng

I am using data provider to pass parameters in testng and want to print custom testcase name (it will be based on the type of data I am passing to the testcase). How do i do it?
Parameters in Dataproviders looks like what you want.
If you declare your #DataProvider as taking a java.lang.reflect.Method
as first parameter, TestNG will pass the current test method for this
first parameter.
That bit of documentation also provides an example.

Resources