Suffix in perspective table

Good morning,
I'm trying to add the suffix in a perspective table column.

Here I just format the number as 0.00

but if I add the % the number gets crazy

Thanks for the help

The table rendering is "smart". If you render 0.37 as % you get 37%.
There's a fix. I'm trying to remember ...

Maybe try something like

#0.00%

Data Type Formatting Reference | Ignition User Manual (inductiveautomation.com)

my default percent format is different than yours

image

No, the documentation on that page says,

%    Multiplies the value by 100 and shows as a percent.

That is the problem. It multiplies by 100.

1 Like

image
this example may work fine

Try it. It doesn't.
The table column is "smart"!

1 Like

Yeah is not working, is "smart" but not enough :sweat_smile:

It was so easy to manage with the vision power table! Because now I could manage the data so that it works but if I would like to have in my dataset the exactly data that I expect.

Can you divide by 100 in the SQL query (or whatever generates the data)? Then you will have 0.9692 rendered as 96.92%.

I never understood this. This design baffles me...

3 Likes

Yes I could but is so strange that we have to make this strange trick to add a simple suffix, because now I show the data in a table, but the next time I will have to show it in a label and I have to manipulate it every time.

In any case thanks for the help, if you have other ideas that avoid to manipulate the "real" data I will test them

The number formatting is supposed to be based on
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/DecimalFormat.html
which is where the × 100 comes from.
The doc states that you can add strings to the format using the ' single quotes but it doesn't work in the table.

Format Transform:

Format Transform Video at Inductive University

Maybe you can use something like this but you would need to bind it.

But it isn't. It is some javascript-based formatting that I can't find the documentation reference to right now. But it clearly isn't DecimalFormat based on this:

1 Like
  • Put the query binding on a custom property somewhere - maybe on the root.
  • For the table add a property binding to the custom prop and add a script transform on that column.
    output = []
    for row in value:
        row['pcColumn'] = row['pcColumn'] / 100
        output.append(row)
    return ouput

Pascal will be along shortly to reduce this code to one line.

1 Like

I believe it's numeral.js

2 Likes

well... If it's expected then I'll oblige

return [row['pcColumn'] / 100 for row in value]

edit: wait, no, it doesn't do the same thing.
What are we trying to do here ?

edit2: ok we want to keep the full row but divide one value by 100, so:

return [dict(row, **{'pcColumn': row['pcColumn'] / 100}) for row in value]
4 Likes

This is apparently a documented bug, dating back to 2020. No update as to the status however.

Though, I'm not sure I would call it a bug, as it also seems to be expected behavior (at least from the developers perspective)

2 Likes

One other easy way around the problem is to return an extra /100 column from the SQL query and use that in the table while not displaying the raw data which would still be available for other uses.

SELECT
    ...,
    Resa,
    Resa / 100 AS ResaPerCent,
    ...
2 Likes

@Transistor Yes, I guess I will work in this way, is a good compromise