Forum Discussion
Custom number format with leading letters and numbers
- Nov 06, 2023
Adding to answer by Rob_Elliott:
If you have some rows with no value in this number column, above JSON will return value like INC000 for all rows:
So instead of it, use this JSON:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "=if(@currentField, 'INC'+padStart(toString(@currentField),3,'0'), '')" }
Output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Adding to answer by Rob_Elliott:
If you have some rows with no value in this number column, above JSON will return value like INC000 for all rows:
So instead of it, use this JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if(@currentField, 'INC'+padStart(toString(@currentField),3,'0'), '')"
}
Output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.