Question
· 21 hr ago

Sorting by number field type in FDN

I have a custom defined priority field that is being stored as a number type

<record name="LocalClinicalMeSHTerms" type="serial">
<field name="LocalClinicalExpertiseCodedValue" type="{CODETYPE}" codeFamily="HSPD" codeTable="LocalClinicalExpertise" codeScheme="{MASTER}"/>
<field name="LocalCliniclDisplayOrder" type="number"/>
</record>

However, within the overviewIndividual.cls form

				{
					"type": "HSPD.collection",
					"key": "LocalClinicalMeSHTerms",
					"hideExpression": "formState.lib.hideField(formState) && model.LocalClinicalMeSHTerms==''",
					"templateOptions": {
						"label": "LocalClinicalMeSHTerms"
					},
					"data": {
						"collections": {
							"editAs": "inline",
							"pager": {
								"suppressPaging": true
							}
						},
						"pd": {
							"corrections": {
								"display": "formState.lib.getCorrectionsDisplayForArray(model[options.key], 'row.CodedValue.Description', this)"
							}
						},
						"embeddedLabel": "MeSHTerm",
						"embeddedFields": [
							{
								"type": "HSPD.select",
								"key": "LocalClinicalExpertiseCodedValue",
								"templateOptions": {
									"label": "Type",
									"options": [
										{
											"Description": "",
											"_class": "HS.DataManager.Datatype.CodeItem"
										}
									]
								},
								"data": {
									"codeTable": "HSPD.LocalClinicalExpertise",
									"orderField": "Description"
								}
							},
							{
								"type": "input",
								"key": "LocalCliniclDisplayOrder",
								"templateOptions": {
									"type": "number",
									"label": "Priority",
									"model":[
										{
											"minSize":1
										}
									]								}
							}
						]
					}
				}

 

when I first return results from by search it is sorting by highest value so if an Individual had 11 fields, it would display starting with 11.

If I click the sorting function at the top of the column it is not sorting by numeric value.

Anyone have an idea on how I can return the results in the correct "Priority" order and then properly sort the order correctly?

Product version: IRIS 2024.2
$ZV: HealthShare Provider Directory 2024.2.0 Build: 1009 [HealthShare Modules: Core:28.0 + Provider Directory:28.0] - IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2024.1 (Build 267_2_24113U) Wed Jul 2 2025 16:36:55 EDT [Core:28.0|Provider Directory:28
Discussion (1)2
Log in or sign up to continue

To address the issue with your sorting problem in the HealthShare Form (FDN):

  1. Force Numeric Sorting in FDN Forms:
    If the numeric field LocalCliniclDisplayOrder is being sorted as strings, you need to ensure that the sorting mechanism treats the field as a true numeric value. This can be addressed by explicitly defining sorting as numeric either in the form configuration or in the underlying data model:
  • In Forms or Reports Definitions: You can specify sorting as asc numeric or desc numeric for the relevant data dimension property to sort it in ascending or descending numeric order [1].
  • Using Numeric Collation Functions: In cases where the field appears alphanumeric due to initialization or input behavior, consider utilizing SQL collation functions like %PLUS that ensure the numeric strings are interpreted in canonical numeric format. Using %PLUS(LocalCliniclDisplayOrder) in SQL statements can resolve inconsistent ordering [2].
  1. Adjusting Sorting Options in the Display: Ensure that the configuration accounts for numeric ordering by explicitly setting sorting properties in your FDN or data definitions, following best practices for defining levels and sorting orders in InterSystems IRIS [1][3].

  2. Recheck the Input and Formatting: Validate the inputs and display options to ensure that the model accurately reflects the data's type as numeric and isn't being overridden or mismatched by alphanumeric types during input or rendering. You can use tools like $FNUMBER or validation functions to ensure consistent number formatting prior to saving or sorting data [4].

References: [1][2][4][3]

Sources: