Wednesday, August 8, 2007

An OpenOffice.org Annoyance

While working on a form in OpenOffice.org, I noticed something quite annoying.
When you create a form element and bind it to the XML, you can choose what data type you want; date, decimal, string, boolean, etc. On certain data types, such as a decimal, you can define a minimum and maximum range for the data entered:


One would expect you to be able to define a separate range for each different control with type Decimal, right? Wrong. Apparently, if you define a range for ANY control that's type Decimal, it applies to ALL controls of type Decimal. I can't imagine why this is implemented as such because I don't see why you'd want the same range for all different controls. Needless to say, it's problematic.

I'm trying to find the best way to limit the range of values entered for controls such as obs/pulse/value in the OpenMRS forms. In InfoPath, this control (and others like it) have a custom data type, pulse_type_restricted_type, limited to a range of 0-230, inclusive. The entry from the XML schema looks like this:
<xs:simpleType name="pulse_type_restricted_type">
<xs:restriction base="xs:int">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="230"/>
</xs:restriction>
</xs:simpleType>

OpenOffice.org doesn't seem to have this feature. While I can add a custom data type named pulse_type_restricted_type, there doesn't appear to be a way to define a valid range for it. There's an option to add a "Constraint", but I'm not sure how this works. As you can see here, the help files on this are somewhat less than useful:


I'll post some questions to mailing lists and update this post when I've found a solution.

No comments: