[BUG-5618] Perspective format transform with numeric pattern, text being capitalized by default

Hi All

Im trying to use a simple format transform to add a “MPa” unit to my value.
But i realized for text used in the format pattern, they are capitalized by default, and “MPA” was displayed instead.
Is there any way to “un-capitalize” it?
Or any better way to add a unit to a value for label component?

Hey jespinmartin1, thank you for the reply.

So i guess it is meant for “patterns” only.
Because i saw in the inductive university video they have used a prefix as an example, so i was thinking it is applicable for suffix, units etc as well.

But still… How i wish there is a way to remove the default capitalization…

image

You could try wrapping the prefix/suffix in the pattern with ' literals:
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/DecimalFormat.html

1 Like

Clever

Hi Paul, have tried with ‘test’, but still displayed as TEST
image

Hi jespinmartin1, thank you for showing the example with 2 transforms.
Was hoping to do it in 1 transform only, but i guess 2 transforms is the method to do so…

Following @PGriffith advice, you can do it in a single transform.

1 Like

Just looked into it, and the uppercasing is deliberate (we’re specifically doing it in our code) but I can’t really figure out why. That would be the ideal way to do this (creating a formatter is somewhat expensive), but should be fine.

1 Like

To make it match an 80’s HMI? :grin:

2 Likes

I’ve filed a ticket to correct this behavior; there’s no reason to uppercase the pattern.

2 Likes

Thanks for showing how to do it! :smile: