
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 17, 2021 04:20 PM
I am trying to add decimals with 5 or more decimal places. i used the currency field but i cannot add the data via api.
the value here is “gains”=>“0.00072333333333363115”
i get error Airrecord::Error (HTTP 422: INVALID_VALUE_FOR_COLUMN: Field “gains” cannot accept the provided value)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 17, 2021 07:00 PM
Which API are you using? It works fine for me using the REST API.
If you’re using the REST API, you need to use a colon (not a =>), like this:
"gains": "0.00072333333333363115"

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 17, 2021 08:23 PM
That actually depends on the programming language that is calling the REST API. For example, PHP uses =>
in arrays.
I think that the issues is more likely that the code has the invalid data type. If your number is in quotes, then Airtable thinks that you are providing a text string, not a number. Try removing the quotes from the number.
Instead of …
Try …
"gains" => 0.00072333333333363115,

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 17, 2021 08:34 PM
Ah, good to know! Thanks! Does PHP also use ‘=>’ for non-arrays, such as number/currency fields?
(I’m just using CURL, so I use : instead of =>)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 17, 2021 09:08 PM
I’m referring to a PHP array, which is part of the PHP language, and is unrelated to Airtable field types.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 18, 2021 11:22 AM
I am using ruby. i actually dont have quotes around the decimal.
tea=Tea.create(“Symbol” => row[“instrument”], “Date” => row[“entryTime”] ,“TradePattern” => row[“tradepattern”] ,“tradeid” => row[“id”],“position” => row[“entryQty”],“gains” => row[“gains”],“isopen” => row[“isopen”],“account” => row[“account”], “airtable_lastsynctime”=>currenttime)
The data is retrieved from database as a decimal.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 19, 2021 02:54 AM
I think the Suggestion by @kuovonne should be working.
It’s a problem with the data type of a particular field.
By default it’s automatically passed string, store it into a variable and make type conversion then put that variable in that proper place.
