How to allow editing value, but not unit of measurement

Hi All,

I am in a mid of a project where I have to write to a tag with some values which are in feet. I want to display the value in feet but want the operator to just change the value instead having rights to change the unit of measurement. For example; if I have a pass 20 feet level reading to field, I will enter 20 in the numeric editor field, press enter and should see 20 feet on the screen after entering. I am not able to see anywhere how to select a unit of measurement of how to disable the feet if writing through scripts. Would request for help!

We typically display units of measurement separately from the value. The editable field contains only the number. The units of measurement are in a label immediately to the right.

This also makes it relatively easy to support user selectable units of measure for display (editable field doesn’t directly display or edit tag; it runs through a script both ways to convert from base units to display units or vice-versa).

3 Likes

Can you add an expression transform to the field that displays the value?

I cant recall the exact method off hand but looks something like below…

{value} + ' Units'

I left a space after the first ’ as that will leave a space between the value and the Units. Also works for text before…

'Measurement : ' + {value} + 'feet'

Edited, I opened my designer to get a screen shot…

Craig, in your example there there’s no reason to use a separate expression transform (and it’s costing you performance to do so). You can just write your expression directly in the top box:
'Gear Box Oil:' + {this.custom.ExtruderOilPressure} + ' Bar'

2 Likes

Thankyou :grinning: :+1:

To follow up on what @witman said, the correct way to lay out the user interface is with units separate from the values.

Numeric entry and units

There are several reasons for this:

  1. That’s the standard for good GUI. Check everything from MS Word to web forms, etc. That’s what the user expects.
  2. It makes it clear that only a numeric value is to be entered.
  3. It means you can use a Numeric Entry component which will only accept numeric values and reject “feet”.
  4. Numbers can be right-aligned for ease of reading without variable length strings messing up the justification.
  5. Operators will learn which units apply to a particular setting and will quickly learn to focus on the actual value.
  6. Having “20 feet” in the box suggests that all of that data (including the “feet”) is user editable or was previous user entry. This will confuse and is bad design.

Do the right thing!

8 Likes

if I have a pass 20 feet level reading to field, I will enter 20 in the numeric editor field, press enter and should see 20 feet on the screen after entering

It sounded like the OP was entering the value somewhere else, like in a pop up entry box or a different view and he wanted to edit the label displaying the value which is not the entry box and can be a formatted field.

image

However, I agree with you that is the cleanest way.

The issue is that while feeding in the value the operator is able to edit the Bar as well.

If it is in the edit field, of course it can be edited. Use a separate label for the unit, as recommended by @Transistor . There is no other way.