Percent to Decimal conversion in Task Template excludes additional decimal places

I have a Percent column, call it [percent] as an example. This Percent column is set to 2 decimal places, so an example value could be 24.24%

When converted to a Decimal, with an App Formula expression DECIMAL( [percent] ), it outputs as 0.2424, which of course is actually 4 decimal places, and is the expected result.

Iโ€™m needing to push this value out to an external service, via a Bot with Webhook Task with a Template. If I simply use <<[percent]>> in the Template, I get the text value of โ€œ24.24%โ€. I need the outputted value to be โ€œ0.2424โ€. But if I use <<DECIMAL( [percent] )>>, for some reason it strips the last 2 decimal spots, resulting in just โ€œ0.24โ€.

Iโ€™m considering and testing possible workarounds right now, but this feels like a bug to me. What do you think?


EDIT:
As a workaround, simply removing the โ€˜%โ€™ character has worked in my case here, i.e.:

<<SUBSTITUTE( [percent] , "%" , "" )>>

I thought it would actually produce the value 24.24, but it turns out that it produces 0.2424, which is exactly what I want, strange.

2 6 163
6 REPLIES 6

I agree!

I assume you are required to use << >> in the webhooks? (not familiar enough with them)

Itโ€™s apparent that when using << >>, AppSheet is applying some text function to give the โ€œdisplayโ€ result. This is likely because the most common usage of these brackets are in email and message contexts.

But now you have identified a use case where you need to use those brackets BUT receive the raw data - not the display value.

I would consider this a bug.

The resolution is not straight forward because I could imagine webhook use cases that need that raw value while others need the display value. It would seem for webhook usage, it needs to be left in the hands of the developer to decide which version of the value they need.

Thanks for the reply John, I agree on all points.

Yes. A template is a template, no matter if itโ€™s used for webhook, email, SMS, or PDF.

Correct.

To get the raw value:

<<"" & [percent]>>

or:

<<CONCATENATE([percent])>>

or by some other means cast the raw value to its raw text equivalent. In fact, I suspect your use of SUBSTITUTE() works because it casts the value to text before doing the substitution. The text value doesnโ€™t actually include the %, so nothing is actually being substituted. For instance, this would probably get the desired value, too:

<<SUBSTITUTE([percent], "Moosenuggets!", "")>>

Hah.

Same project, same (basic) issue, same solution. Just with a nice long holiday break in the middleโ€ฆ

However, Iโ€™m still not seeing how that would explain the absence of the 3rd and 4th decimal places, when converted to a DECIMAL in a Template.

Because the format for an anonymous decimal value is two decimal places. An anonymous value would be any computed value.

Top Labels in this Space