Perspective table cell value won't accept floating point number

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

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”?


{
  "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"
  }
}

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.

view.json (1.1 KB)

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”

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?

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.

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

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.

Sounds good, thanks.

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.

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.

Makes sense and acceptable for the format.Thanks