Revit API Get StorageType from SpecTypeId
It appears there is currently no direct way of finding out the underlying StorageType of a SpecTypeId
This would be useful in order to determine which of the following is appropriate for a parameter filter.
FilterStringEquals
FilterNumericEquals
FilterIntegerRule
FilterDoubleRule
FilterElementIdRule
FilterStringRule
Would also make it more straightforward to validate the string input from a UI textbox if there were contextual StorageType info for the parameter id being used in the filter.
i.e. For an input string you would use Integer.TryParse first since Double.TryParse would return true for strings in the form of integer and double, lastly you would assume string. This resolution of string input could all be avoided if you knew the storage type of the parameter being used in the filter.
Whilst it is true you can get an example element from the document to determine the StorageType this is a cumbersome approach and would fail if no such element existed i.e. in a sparsely populated project file containing bound parameters.
Adding a conversion function for SpecTypeId to StorageType would also allow the following functions to be utilised in a UI to display more appropriate parameter filters:
SharedParameterElement.Lookup (shared project parameters)
or filtering for type of
ParameterElement (non-shared project parameters).
Then from above getting SpecTypeId from ParameterElement.GetDefinition.GetDataType
For built-in parameters there is already a method for getting storage type from the parameter id i.e.
Document.TypeOfStorage however this is not applicable to other parameters.
Refer to below for further discussion