A ReportOption stores information about an option that allows a user to customise the report. ReportOptions are loaded from the report definition, but can also be added and modified using the API.
Example
This example shows how to create a ReportQuery and populate the ReportOptions with values from the QueryString.
var query = ReportGallery.NewReportQuery(“InvoiceReport”);
query.Context.SetContext(“AccountId”, accountId);
foreach (var option in query.ReportOptions)
{
if (!string.IsNullOrEmpty(Request.QueryString[option.Id]))
{
option.Value = Request.QueryString[option.Id];
}
}
Properties
Caption | The caption of the option that will be displayed in the HTML report if the option is visible. |
Id | The unique id of the option that is used to reference the option from within report formulas. |
Value | The selected value of the option. |
IsVisible | If true, then the option will be displayed in the HTML report. If false, then the option will not be displayed, but the value will still be available from within report formulas. Hidden options are useful for passing parameters to a report from a URL. |
ValueOrDefault | The selected value if one has been selected, otherwise the default value. |
ControlType | The ‘type’ attribute of the option as described in the Report Options section of Report Definitions, ie LIST, TEXT, NUMBER, etc. |
DefaultValue | The default value of the option. |
DisplayValue | If the option is a list, then the display value is the text value of the OptionItem that the user selected, whereas the Value is the id of the selected OptionItem. |
OptionTypeCode | The ‘data’ attribute of the option as described in the Report Options section of Report Definitions. This is used to populate the option with data. |
Options | If the option is a list, then this is a list of ReportOptionItems, containing the values that will be in the list. This list can either be specified in the report definition, or can be populated from the GetOptionDataCallback. |
Methods
Update | Updates the selected value with the value of the specified report option. |
Reset | Resets the list of Options. |
ToJson | Writes out the option to a JSON string that can be parsed and rendered by moxy.js |
Click to see Comments