Scroll

Create a Parameter with the .NET Api

The following is a quick explanation for how to create a Parameter using the Exago .NET Api.

Introduction

First, ensure that your application is referencing the Parameter class, which is located in the WebReports.Api.Common namespace.

using WebReports.Api.Common;
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.

Example

/* Manually Creating a Parameter */
Parameter myParam = myApi.Parameters.NewParameter();

myParam.Id = "MyParameter";
myParam.DataType = 0;
myParam.Value = "Hello World";
myParam.IsHidden = false;
myParam.PromptText = "";

Breakdown

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.


Hidden Article Information

Article Author
Exago Development
created 2016-02-02 18:46:14 UTC
updated 2017-02-21 16:45:27 UTC

Labels
parameters, How Do I, API, .NET, How-To,
Have more questions? Submit a request