The following is a quick explanation for how to create a Parameter using the Exago .NET Api.
First, ensure that your application is referencing the Parameter class, which is located in the WebReports.Api.Common namespace.
NOTE: Some Visual Studio templates automatically include the Windows System.Web.UI.WebControls namespace, which contains a class called "Parameter". Ensure that your application is not accidentally referencing this class.
/* Manually Creating a Parameter */
Parameter myParam = myApi.Parameters.NewParameter();
myParam.Id = "MyParameter";
myParam.DataType = 0;
myParam.Value = "Hello World";
myParam.IsHidden = false;
myParam.PromptText = "";
NOTE: Parameters created in the API are unique to their session.
Use the convenience method, Api.Parameters.NewParameter() to create a new parameter. You'll then need to set the following fields:
myParam.Id - Analogous to the Name field in the Parameter creation dialog in the Admin Console (see above). This is the unique identifier for the parameter. This field is required.
NOTE: Special characters and spaces are not permitted.
myParam.DataType - Analogous to the Type field. Each type is represented by an integer. This field is required. The following options are permitted:
- 0 - string
- 1 - date
- 2 - integer
- 3 - decimal
myParam.Value - Analogous to the Value field. This field must be a string, regardless of the DataType selected (Exago will convert the data). This field is required.
myParam.IsHidden - Analogous to the Hidden field. Specify whether or not the parameter will appear as a selectable option in the Report Designer. This field is required.
myParam.PromptText - Analogous to the Prompt Text field. If this field is set, a report using this parameter will prompt for a value upon execution. This field is optional.