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
Related
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.
I'm trying to create a re-usable script for capturing record changes onSave with Server-side scripting. To do that, I need the model information for a given table, including what type each field is.
I have figured out how to get the model for my table and details for the fields:
var table = "Clients";
var myObject = app.models[table];
// Dump the properties of the 2nd field in the model
console.log("Field 2 properties: " + JSON.stringify(myObject["L"]["fields"]["1"]));
I see this:
{"name":"Client",
"key":"zzzkS1spSPKkRXMn",
"displayName":null,
"description":"Short name for client (must be unique)",
"type":{},
"required":false,
"uid":false,
"defaultValue":null,
"minLength":0,
"maxLength":null,
"integer":false,
"sortable":true,
"minValue":null,
"maxValue":null,
"regexp":null,
"regexpError":null,
"possibleValues":null,
"aggregationType":null
}
"type" looks like an empty property here and I can't seem to figure out how to get any reference to it to tell me what I need.
How do I get usable type information for a given field in a model?
Right now, App Maker doesn't expose an API to access the model metadata.
You snippet is actually accessing App Maker's internal state and might break in future releases (the "L" property is actually obfuscated by a JS compiler and not designed to be accessed from user land).
We know this kind of meta-programming is handy and this is something we might add in the future based on user feedback. Please feel free to submit a request feature in our issue tracker (https://developers.google.com/appmaker/support).
I have a task to export a repeat grid's content to Excel. I have read an
article, but I still can't realize how to properly use it. I tried to repeat article's steps to provide pzRDExportWrapper, but after I click "Save" button I get the error:
Method: Rule-Obj-Activity instance not found:
Sb-FW-CTrackFW-Work.pzRDExportWrapper. Details: Invalid value for
Activity name passed to ActivityAssembler.
Could anybody give me any suggestions? Thank you.
You invoke activity from another activity which applies to class Sb-FW-CTrackFW-Work. Rule Resolution use primary context Sb-FW-CTrackFW-Work class and try invoke activity pzRDExportWrapper from it and you get error (because rule resolution can't found invoked activity in this class).
Activity pzRDExportWrapper applies to Rule-Obj-Report-Definition class. Try invoke from it.
Try activity step as below:
Call Rule-Obj-Report-Definition.pzRDExportWrapper
Or use step page for this step which defined as applies to Rule-Obj-Report-Definition class(you can declare it on Pages&Classes tab)
Okay. I have resolved the issue (thank you njc). I have two sections on a lone web page.
A context of the first section is my custom data page Co-Name-FW-Data-Search. The Search page has some single value properties which are initialized by an user via an UI.
The second section is a repeat grid section, a report definition as a source. My Search page pointed out in a Pages and Classes tab. Also there is a Page, which is created by report definition and contains results. The report definition takes Search’s values as parameters.
So, I have created an activity and passed the Search page and a Cods-Pega-List MyResultList as parameters. There are some steps in the activity:
Check if Search is null. If true- skip step; else - transfer Search properties into Params props with Data Transform.
Set Param.exportmode = "excel"
Call pzRDExportWrapper with Step Page MyResultList.pyReportDefinition. Pass current parameter page.
P.S.: If it doesn’t work try to play with report definition’s settings.
P.P.S.: An only minus of pzExportWrapper is that it invokes report definition again.
I need to create an (archetypes) object from a View of a second object (object2 - which is not the parent of the new object). It needs to be prepopulated with data from the Request, and from object2.
The simple solution would seem to be to use "default_method" on the schema fields, and that can work for the data from the Request, but I don't believe I have access to the View from there, and therefore not to object2, either. In any case, one of the fields is a ReferenceField to object2 and I've read that ReferenceField ignores "default_method".
The other option is to create it inside the portal_factory, set its defaults, and then display the Add page, allowing the user to modify the content as required, or to exit without actually creating the object. Perfect, except that, of the multitude of methods available to create an object, (invokeFactory(), _createObjectByType(), _constructInstance() & createObject(), that I know of), only createObject actually leaves the object in the portal_factory - and since it only returns a string (the URL of the object's Add page), won't accept keyword arguments, and doesn't seem to notify any events (certainly not IObjectCreatedEvent), I can't see how to modify that with my data before directing the user to the edit page.
This is the pattern that I recommend when is not possible to use createObject:
_id = self.context.generateUniqueId("Document")
_id = self.context.invokeFactory(type_name=type_name, id=_id)
ob = self.context[_id]
ob.edit(
description = "text...",
subject = ('tag1', 'tag2'),
title = "some title...",
)
ob._renameAfterCreation(check_auto_id=True)
_id = ob.getId()
Doh. Finally figured it out.
createObject doesn't, in any real sense, create an object. It really is just a URL to the creation form.
Call .createObject(), get the URL for the form, attach the values you want as query parameters:
url = folder.createObject(type_name='xxx')
url += ?title=abc&description=def...'
self.request.RESPONSE.redirect(url)
will do it.
A minor question that I hope admits of a simple answer that I'll kick myself for not noticing.
So, when we have the following overload of RegisterStartupScript
public static void RegisterStartupScript(
Control control,
Type type,
string key,
string script,
bool addScriptTags
)
we have to provide a type as well as a control. Now, I can see what the point of specifying the control - the script gets pushed out just in case the control is part of the partial page render. But what is the point of the Type parameter? Usually one just sets it to the type of the control. And this is in fact the suggestion made by MSDN:
control
Type: System.Web.UI..::.Control
The control that is registering the client script block.
type
Type: System..::.Type
The type of the client script block. This parameter is usually specified by using the typeof operator (C#) or the GetType operator (Visual Basic) to retrieve the type of the control that is registering the script.
So why do we have to specify it? Presumably not just to spare the .Net Framework the bother of retrieving the runtime type itself.
Usually type is the type of the page or control that registers a script. This is just a way to prevent that two different controls register different scripts using the same key.
Excerpt from MSDN:
A client script is uniquely identified
by its key and its type. Scripts with
the same key and type are considered
duplicates. Only one script with a
given type and key pair can be
registered with the page. Attempting
to register a script that is already
registered does not create a duplicate
of the script.