Failed Webhook, blank value cannot be converted to type 'Decimal'

Good morning all, please take a look at the below screenshot. I have a Webhook that is triggered from a 3rd party service that parses incoming .CSV files into an “Add Row” action. I’m running into an issue where if a cell is blank, the parsing service tries to send the two double quotes “” indicating a blank input, but Appsheet appears to reject the input with the following error {“Message”:“REST API invoke request failed: Error: Value ‘’ in field ‘Size’ in table ‘Traditional_Takeoff’ cannot be converted to type ‘Decimal’.”}

My question is, is there a better way to structure the webhook template to handle a blank entry? Or is there something else that I might be missing, I would prefer not to have to replace blank entries with 0.0.

Template below followed by payload and error screenshot.

{
"Action": "Add",
"Properties": {
"Locale": "en-US",
"Timezone": "Pacific Standard Time"
},
"Rows": [
{
"UniqueID": "{{mail_attachments_0}}",
"Phase Description": "{{mail_attachments_5}}",
"Sub-Phase Description": "{{mail_attachments_6}}",
"Takeoff Identifier": "{{mail_attachments_7}}",
"Building Number": "{{mail_attachments_8}}",
"Drawing Number": "{{mail_attachments_9}}",
"Schedule Activity": "{{mail_attachments_10}}",
"Planning Area": "{{mail_attachments_11}}",
"Insulation Class": "{{mail_attachments_12}}",
"Insulation Type": "{{mail_attachments_13}}",
"Size": "{{mail_attachments_14}}",
"Size (adj)": "{{mail_attachments_15}}",
"Thk": "{{mail_attachments_16}}",
"TW Remaining LF": "{{mail_attachments_17}}",
"Pipe": "{{mail_attachments_18}}",
"90s": "{{mail_attachments_19}}",
"45s": "{{mail_attachments_20}}",
"Tees": "{{mail_attachments_21}}",
"UCs": "{{mail_attachments_22}}",
"WVs": "{{mail_attachments_23}}",
"BVs": "{{mail_attachments_24}}",
"FPs": "{{mail_attachments_25}}",
"FVs": "{{mail_attachments_26}}",
"Strainers": "{{mail_attachments_27}}",
"Bends": "{{mail_attachments_28}}",
"Ecaps": "{{mail_attachments_29}}",
"Rdcrs": "{{mail_attachments_30}}",
"SF": "{{mail_attachments_31}}",
"Direct Hours": "{{mail_attachments_32}}",
"Total Hours": "{{mail_attachments_33}}",
"Support Hours": "{{mail_attachments_34}}",
"Phase": "{{mail_attachments_35}}"






}

0 5 431
5 REPLIES 5

Sounds like a bug - I would report this to support@appsheet.com.

Ca you eliminate both the field name and value from the REST API call?
The field would then gets its default value.

Unfortunately I can only create one template for the 3rd party tool and it does not allow for variables within the template. So in this case, the field giving me issues may be blank on one row, and contain a value in the next. I believe the correct way to handle this is with Appsheet expressions or variables, but I have tried absolutely every variation I can think of and I still receive an error.

I tried to address the decimal conversion error with the following:

<<If: number("{{mail_attachments_14}}") > 0>>
"Size": "{{mail_attachments_14}}",
<<EndIF>>

But that gives me a general 500 error and causes the webhook to fail. I’ve tried many other expressions and methods to fix this but I am unable to get anything to evaluate without giving me a 500 error.

With the decimal conversion issue, this format makes the most sense to me, but I definitely need some help figuring out the cause of one of these issues…

{
"Action": "Add",
"Properties": {
"Locale": "en-US",
"Timezone": "Pacific Standard Time"
},
"Rows": [
{
"UniqueID": "{{mail_attachments_0}}",
"Phase Description": "{{mail_attachments_5}}",
"Sub-Phase Description": "{{mail_attachments_6}}",
"Takeoff Identifier": "{{mail_attachments_7}}",
"Building Number": "{{mail_attachments_8}}",
"Drawing Number": "{{mail_attachments_9}}",
"Schedule Activity": "{{mail_attachments_10}}",
"Planning Area": "{{mail_attachments_11}}",
"Insulation Class": "{{mail_attachments_12}}",
"Insulation Type": "{{mail_attachments_13}}",
<<If: number("{{mail_attachments_14}}") > 0>>
"Size": "{{mail_attachments_14}}",
<<EndIF>>
"Size (adj)": "{{mail_attachments_15}}",
"Thk": "{{mail_attachments_16}}",
"TW Remaining LF": "{{mail_attachments_17}}",
"Pipe": "{{mail_attachments_18}}",
"90s": "{{mail_attachments_19}}",
"45s": "{{mail_attachments_20}}",
"Tees": "{{mail_attachments_21}}",
"UCs": "{{mail_attachments_22}}",
"WVs": "{{mail_attachments_23}}",
"BVs": "{{mail_attachments_24}}",
"FPs": "{{mail_attachments_25}}",
"FVs": "{{mail_attachments_26}}",
"Strainers": "{{mail_attachments_27}}",
"Bends": "{{mail_attachments_28}}",
"Ecaps": "{{mail_attachments_29}}",
"Rdcrs": "{{mail_attachments_30}}",
"SF": "{{mail_attachments_31}}",
"Direct Hours": "{{mail_attachments_32}}",
"Total Hours": "{{mail_attachments_33}}",
"Support Hours": "{{mail_attachments_34}}",
"Phase": "{{mail_attachments_35}}"
}
]
}

Try putting the <<IF>> and <<EndIf>> on a single line.

This JSON is coming from a 3rd party tool you said right?

Template IFs are an Appsheet thing. Putting them in your JSON template in another tool isn’t going to do anything. Or am I mistaken by the situation here? Is there any sort parsing language in the other tool?

You could always change all the columns that may receive blank data into Text type columns. If you need to do calculations on them just use NUMBER() or DECIMAL().

Top Labels in this Space