# Perspective table cell value won't accept floating point number

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [September 11, 2020, 8:06pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612 "2020-09-11T20:06:56Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 8:06pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/1 "2020-09-11T20:06:56Z")

</div>

I can put it in there with double or single quotes, but would rather it just be the value instead.Thx

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 11, 2020, 8:29pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/2 "2020-09-11T20:29:13Z")

</div>

We need some more information on what you’re attempting to do because I was able to specify a float value and apply formatting as expected. Could you either supply the view.json of the View which contains your table or some in-depth explanation of the data you’re attempting to supply, as well as what you mean by “won’t accept”?

 ![Screen Shot 2020-09-11 at 1.29.15PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8a84d88b52b551e02a09db420ede9842b1e428c1.png)  
 ![Screen Shot 2020-09-11 at 1.29.32PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/e/ee189163bd19118c85ff788eb5ed877f6cb87668.png)

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 8:34pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/3 "2020-09-11T20:34:50Z")

</div>

```auto
{
  "custom": {},
  "params": {},
  "props": {},
  "root": {
    "children": [
      {
        "meta": {
          "name": "Table"
        },
        "position": {
          "height": 400,
          "width": 509.99999999999994
        },
        "props": {
          "data": [
            {
              "CompVolts": {
                "style": {
                  "backgroundColor": "white"
                },
                "value": "\u0027480.0\u0027"
              },
              "Company": {
                "style": {
                  "backgroundColor": "white"
                },
                "value": "SomeCompany"
              },
              "Location": {
                "style": {
                  "backgroundColor": "white"
                },
                "value": "SomeLocation"
              },
              "Unit": {
                "style": {
                  "backgroundColor": "white"
                },
                "value": 1
              }
            }
          ]
        },
        "type": "ia.display.table"
      }
    ],
    "meta": {
      "name": "root"
    },
    "type": "ia.container.coord"
  }
}

```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 11, 2020, 8:35pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/4 "2020-09-11T20:35:47Z")

</div>

It’s a lot easier if you just attach the .json file, but I’ll make it work. Formatting the JSON as code also helps - in the future.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 8:36pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/5 "2020-09-11T20:36:40Z")

</div>

[view.json](https://forum.inductiveautomation.com/uploads/short-url/6FaMZHdcTHBlHuCjH6hEl2xEWxE.json) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 11, 2020, 8:41pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/6 "2020-09-11T20:41:34Z")

</div>

Okay, so the issue is actually that the Table needs to have a format applied, as well as have the render type adjusted to suit your needs.

Perform the following steps, just like I provided in the earlier sreenshots:

1. Verify you have a `Table.props.columns` item for each column. `Table.props.columns[0].field` should have a value of “CompVolts”.
2. Set `Table.props.columns[0].render` to a value of “number”.
3. Set `Table.props.columns[0].numberFormat` to a value of “0,0.0”

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 8:46pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/7 "2020-09-11T20:46:02Z")

</div>

Thank you, I’m really new to perspective, vision was cake. Do I put these in the header groups, or should I modify the json directly and import it?

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 8:51pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/8 "2020-09-11T20:51:42Z")

</div>

I found it, same issue though. If I have a decimal point in the value it won’t save the decimal and anything after it.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 8:53pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/9 "2020-09-11T20:53:33Z")

</div>

also, I can put in something like .08389 and it shows up correct.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 11, 2020, 8:54pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/10 "2020-09-11T20:54:07Z")

</div>

The json should save any non-zero number after a decimal. I’m not sure why it drops “.0”. I’ll ask Dev why that happens. This is why formatting is so important, however.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 8:55pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/11 "2020-09-11T20:55:45Z")

</div>

Sounds good, thanks.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 8:57pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/12 "2020-09-11T20:57:53Z")

</div>

yeah, it’s just turning the .0 into nothing, which is fine. It just looked weird when it kept nuking the precision. Thank you again.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 11, 2020, 8:58pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/13 "2020-09-11T20:58:23Z")

</div>

Dev believes it just to be an idiosyncrasy of JSON parsing. Essentially, when the value is parsed and put into the schema, the process boils `450.00000000000000` down to `450` (possibly to save space because the value is the same). Obviously it can’t do that for Strings.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [September 11, 2020, 9:02pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/14 "2020-09-11T21:02:25Z")

</div>

Makes sense and acceptable for the format.Thanks

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [July 12, 2024, 3:41am UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/15 "2024-07-12T03:41:01Z")

</div>

Already

1. Set props.columns[2].field have a value of " value".
2. Set `Table.props.columns[2].render` to a value of “number”.
3. 
  1. Set `Table.props.columns[2].numberFormat` to a value of “0,0.0”  
 ![467ae1cf1fb1b3cdb11dc89e2685cb6](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/c/3c2dc00c334516cd037d86b846b85a9c36273490.png)

But when I bind a float into the Dataset,it shows error?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/f/1f9705c467b035785366c6f093e426f97a8c6509.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 14, 2024, 4:23pm UTC](https://forum.inductiveautomation.com/t/perspective-table-cell-value-wont-accept-floating-point-number/38612/16 "2024-07-14T16:23:02Z")

</div>

> [@taohongyu88](#):
>
> But when I bind a float into the Dataset,it shows error?

This has nothing to do with the Table, and everything to do with the fact that the `toDataSet` function doesn't actually "convert" data - your data MUST already be in a valid format with all columns having the same datatype as exists in the first row.

In your code example, the very first row contains an integer value in the 2th column, which means that every other row must have an integer value in the 2th column.

You can either change the problematic value to be an integer, or you can cast the value in use for the 2th column of the 0th row to be a float.
