Numeric Range

The following numeric range types are handled by this component:

  • Integer
  • Decimal
  • Currency
  • Slider

The Numeric Range component is used to display an integer, decimal, currency or slider to users. The different numeric types are displayed as options when creating the field, the default display type being Decimal.

Component Code

The first section of the code for the component contains the standard parameter set along with the variables needed for the component to function. Following the variables are the methods used by the component which are listed below.

OnParametersSetAsync()

This method is called after the component has initialized and when there’s an update to the parent component. Its purpose is to assign values to variables.

ValueChanged()

This method is called when the value of the numeric range field has changed. This method ensures the field is modifiable then validates the input. If those conditions are met then the ChangeXML method is called, otherwise nothing happens.

SliderValueChanged(RangeSliderChangeEventArgs object)

This method is called when the value of the slider field is changed. This method ensures the field is modifiable, assigns the slider field value to the valueUXStart and valueUXEnd variables and, ensures there are no validation errors. If those conditions are met then the ChangeXML method is called, otherwise nothing happens.

ChangeXML()

This method is used to update the XML of the instance to reflect the value of the numeric range field. When called the required XML is generated, the element name is equal to the XMLName variable, and the current value of the field changed (or both fields) represented as the valueUXStart and valueUXEnd variables.

Lastly, a call is made to the ChangeField method on MyInstance and the new XML is passed.

Below is an example of the XML structure to be saved:

<NumericRangeEx>
    10 - 20
    <Start>10</Start>
    <End>20</End>
</NumericRangeEx>
Updated on January 3, 2023

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment