[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.

3 Likes

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:

To date the pattern is still uppercased. Has the ticket you filled ever been solved?

No, it's never risen to the top of the pile of work the Perspective team has in front of them, so it's still sitting in a backlog.

Okay. Is it expected to be fixed at some point? 3 years in a backlog seems a lot for a bug like this

Yes, at some point. The problem is prioritization; this is marked as a low priority issue (because it's easy to work around) and not a super common problem. Add that to the literally thousands of tickets we have, some of which will inevitably be a higher priority, and we don't get to items like this for years, even though it's absolutely not a complicated issue to fix. :person_shrugging:

Understood. Thank you for the info. I would of thought that time in the backlog would of been a factor in prioritisation.