SharePoint List JSON Format Column Exponentation

Yuki365 21 Reputation points
2022-03-29T08:22:02.07+00:00

Hi everyone,
I formatted my SharePoint list column using JSON.
I created a json code using pow, but it doesn't have exponential notation unless it has more than 21 digits.

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=pow('@currentField',1)"
}

For example, if it is "100000000000", I want to display "1E + 11".

How can i do this with json formating?

thank you appreciate your help here.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
8,526 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,386 questions
{count} votes

Accepted answer
  1. Yi Lu_MSFT 17,361 Reputation points
    2022-03-30T08:52:21.117+00:00

    Hi @Yuki365
    In column formatting, we could not use pow and round, so we could not get the value you want and write up to two decimal places directly.

    As a workaround, you said "The value to be processed indicates the concentration of the chemical substance, and the numerical value from the 10th power to the 13th power is handled", so I suggest you to use the following code to replace pow:

    {  
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  
      "elmType": "span",  
      "txtContent": "=if(((((@currentField)/10000000000<10,(@currentField)/10000000000 +'E+10',if((@currentField)/100000000000<10,(@currentField)/100000000000 +'E+11',if((@currentField)/1000000000000<10,(@currentField)/1000000000000 +'E+12',(@currentField)/10000000000000 +'E+13')))"  
    }  
    

    The result will be:

    188198-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful