Display SP value as percentage in Powerapp form
-
08-02-2021 - |
문제
I have a SharePoint list with a column that is displayed as a percentage: the minimum value is 0, the maximum is 100:
This is displayed nicely as percentage value, i.e. 11%
However, when I am trying to use PowerApps as an input form, it allows only values between 0 and 1
How to allow users to enter the percentage value instead of a fraction (so 11% instead of 0.11)?
다른 팁
This is default behavior in PowerApps for number fields which are being shown as percentage in SharePoint because it stores values from 0 to 1 in back-end.
Workaround:
- Change your number field to regular number field (by removing show as percentage in column settings).
- Use JSON/Column formatting to show this field as percentage in list view.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "= @currentField + '%'"
}
Output:
References:
The SharePoint answer is simple - no JSON code is required. A percentage is a decimal value less than 1. If you want your column to read 44%, then you have to enter it at .44. SharePoint will convert it to a % in the column. This will work regardless of how people enter data in your list - default form, quick edit, details pane, etc.
As for getting it to display in Power Apps, I'm working on that myself. I assume it has to do with Format.