Skip to main content

I need to set the output of a Ui-only formula field to a certain number of decimals based on a field in another model. Basically I’m looking for the equivalent of


value.toFixed({{$Model.OtherModel.data.0.Number_of_Decimals}})


which I could do in a javascript snippet, but there doesn’t seem to be any function similar in the ui-only functions area.


I know I can make a field editor or table, add my values in there, then use a custom render snippet, but I want to show these values in a Template/Text component.

Jack, I don’t believe there’s a declarative way to do this right now. But one thing that is coming in the next release is improved support for custom formula functions, which let you use JS snippets to create functions that can then be referenced declaratively in UI-only formula fields.


Note: this feature is coming for V2 only, so if you’re working in a V1 page you wouldn’t have access. However, if custom JS field renderers was one of the obstacles for moving to V2, those are also coming in this next release.


Could you give a little more info on the use case? I’d like to understand more about a scenario where you would dynamically determine the number of decimal points.


Hi Matt, thanks for the response. We have a scorecard table that our users set up themselves where the rows are different metrics as they define them and the columns are month/quarter/year aggregations of data for that metric for that time period. They are looking at things with various measurements like Units of Blood Transfused, which might have 4 degrees of precision, and Days Listing to Transplant, which should be whole numbers. In the table itself, each cell is using a field renderer that sets the number of decimals based on a field on the metric itself. In my use case, if I used a Field Editor or Table instead of Template components (yes it’s a v1 page) I could use a field renderer snippet, but I’m being lazy in terms of styling and wanting to just use a Template because it’s easier to style the way I want. So there’s definitely a workaround, but thought I’d ask before taking it. a{“insert”:“\n”},{“insert”:{“embed-external”:{“data”:{“url”:“https://us.v-cdn.net/6032350/uploads/R84K0YBR26BQ/screen-shot-2020-08-11-at-11-19-56-am.png”,“name”:“Screen Shot 2020-08-11 at 11.19.56 AM.png”,“type”:“image/png”,“size”:66958,“width”:536,“height”:634,“embedType”:“image”},“loaderData”:{“type”:“image”}}}},{“insert”:{“embed-external”:{“data”:{“url”:“https://us.v-cdn.net/6032350/uploads/ID7BL2IMIPQL/screen-shot-2020-08-11-at-11-33-19-am.png”,“name”:“Screen Shot 2020-08-11 at 11.33.19 AM.png”,“type”:“image/png”,“size”:66788,“width”:937,“height”:477,“embedType”:“image”},“loaderData”:{“type”:“image”}}}},{“insert”:“\n”}]


Reply