Teneo Developers Community

Extract values for units


I would like to pickup weight units in order to be able to tell the user how much more can be packed in a parcel.

I found that there is an automatic annotation called %$UNIT.NER which recognizes weight units automatically in the input. I tried to extract the value using a listener with the following condition:


But when I then print the value for amount, I always get it with the unit. Is there a way that I can access the value only, without the unit?

Thanks in advance!


Hi John,

We have created a pre-built solution which you could have a look at. It deals with unit conversions and for that task, one also needs to access the values of the units.

In particular, it makes use of an entity VALUE_UNITS.ENTITY which has been created for this particular solution, and which allows you to access the value of the unit. You could import this solution into your solution and then for example add the following to a flow listener condition (or wherever you want to pickup the unit):


with amount being the variable that then holds the value of the unit. For 12kg this would be 12.

I hope this helps, feel free to let me know if it does not :slight_smile:



Hi again,

thanks for the hint! I got it to work now.

There is just one thing that is odd. When I try negative values like -500g, the value I get is still 500 and not -500. Is there a tweak for that as well?



Hi John,

If you want to catch negative values as well, you simply have to extend your listener condition as follows:

(%VALUE_UNITS.ENTITY^{amount=lob.amount} / ("-" >> %VALUE_UNITS.ENTITY^{amount=-lob.amount})):L

Best wishes,


1 Like

That works!!! Thanks, Fabienne!