# Suffix in perspective table

**URL:** <https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 3, 2024, 1:10pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287 "2024-06-03T13:10:01Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [June 3, 2024, 1:10pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/1 "2024-06-03T13:10:01Z")

</div>

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

Here I just format the number as `0.00`

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/5/354d87c1627810d59c4b0e954722f9542c78dafe.png)

but if I add the % the number gets crazy

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/b/cb789319ea23e70c952a1d949b8e9a3d352489ac.png)

Thanks for the help

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 3, 2024, 1:15pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/2 "2024-06-03T13:15:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [June 3, 2024, 1:57pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/3 "2024-06-03T13:57:52Z")

</div>

Maybe try something like

#0.00%

[Data Type Formatting Reference | Ignition User Manual (inductiveautomation.com)](https://docs.inductiveautomation.com/docs/8.1/appendix/reference-pages/data-type-formatting-reference#date-format)

my default percent format is different than yours

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5cc80b619cbcd0bd29378e844800cbfd2c6ca0d8.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 3, 2024, 2:12pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/4 "2024-06-03T14:12:15Z")

</div>

No, the documentation on that page says,

> **`%`** &nbsp;&nbsp;&nbsp;Multiplies the value by 100 and shows as a percent.

That is the problem. It multiplies by 100.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [June 3, 2024, 2:17pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/5 "2024-06-03T14:17:38Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/b/abcd87c4577d2ef863ad6a45ff9dcf824ec24099.png)  
this example may work fine

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 3, 2024, 2:19pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/6 "2024-06-03T14:19:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [June 3, 2024, 2:24pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/7 "2024-06-03T14:24:39Z")

</div>

Yeah is not working, is "smart" but not enough 😅

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.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 3, 2024, 2:26pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/8 "2024-06-03T14:26:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 3, 2024, 2:30pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/9 "2024-06-03T14:30:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [June 3, 2024, 2:38pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/10 "2024-06-03T14:38:25Z")

</div>

> [@Transistor](#):
>
> 6.92%.

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

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 3, 2024, 2:41pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/11 "2024-06-03T14:41:31Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [June 3, 2024, 2:44pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/12 "2024-06-03T14:44:52Z")

</div>

Format Transform:

[Format Transform Video at Inductive University](https://inductiveuniversity.com/videos/format-transform/8.1)

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 3, 2024, 2:47pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/13 "2024-06-03T14:47:08Z")

</div>

> [@Transistor](#):
>
> based on  
> [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/DecimalFormat.html](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/DecimalFormat.html)  
> which

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:

> **[Table Column Configurations | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-display-palette/perspective-table/table-column-configurations#changing-applied-formatting)**
>
> This page contains examples that involve making changes to a table component's columns property.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 3, 2024, 2:47pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/14 "2024-06-03T14:47:58Z")

</div>

> [@Aiasa21](#):
>
> if you have other ideas ...

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

```python
    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.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 3, 2024, 2:48pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/15 "2024-06-03T14:48:10Z")

</div>

I believe it's numeral.js

> **[Numeral.js](http://numeraljs.com/)**
>
> A javascript library for formatting and manipulating numbers.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 3, 2024, 2:49pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/16 "2024-06-03T14:49:33Z")

</div>

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

```python
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:

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

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 3, 2024, 3:22pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/17 "2024-06-03T15:22:07Z")

</div>

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

> [@\[BUG-13805 & BUG-13804\] Perspective - Table issues (percentage and header justify)](https://forum.inductiveautomation.com/t/bug-13805-bug-13804-perspective-table-issues-percentage-and-header-justify/24472):
>
> I’m using the nightly update from last Friday (b2019042602) Issue 1 - percentage: I’ve been trying to make the column to show a number in a range 0-100 to just add the percent sign but it always multiplies by 100, regardless of single/double quotes and space. I would think it shouldn’t multiply if it has quotes around the percent sign. Am I missing something? [https://docs.inductiveautomation.com/display/DOC80/numberFormat](https://docs.inductiveautomation.com/display/DOC80/numberFormat) Screenshot: Issue 2 - table header justify: the property ju…

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)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 4, 2024, 12:26pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/18 "2024-06-04T12:26:54Z")

</div>

> [@Aiasa21](#):
>
> ... if you have other ideas that avoid to manipulate the "real" data I will test them ...

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.

```python
SELECT
    ...,
    Resa,
    Resa / 100 AS ResaPerCent,
    ...

```

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [June 4, 2024, 1:03pm UTC](https://forum.inductiveautomation.com/t/suffix-in-perspective-table/91287/19 "2024-06-04T13:03:08Z")

</div>

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