Possible value for table pa_indicator column number format.

VinayC
Tera Contributor

Hi Team,

 

Can anyone help me to change the value for Number Format column "kMGTPE" in pa_indicator table, as it shows the value in kilo, Mega, Giga($5.35G). Now customer is asking these value should be KMBT ($5.35B) format.

 

So actually we are looking for the other possible value than kMGTPE for table pa_indicator column number format.

 

Any help will be highly appreciated.

3 REPLIES 3

Community Alums
Not applicable

Hi @VinayC ,

 

ServiceNow uses the International System of Units (SI) notation by default, and these must follow specific rules, typically represented by characters like "kMGTPE" for kilo, Mega, Giga, Tera, Peta, Exa, respectively.

 

If the customer is requesting formats such as "KMBT" for thousand, million, billion, trillion, this cannot be directly set using the standard Number format(scores_format) field since it expects the SI units format. As ServiceNow does not natively support the "KMBT" format via the scores_format property, you need to implement a custom solution.

 

Below is the approach you can follow:

Instead of changing the scores_format field, you can create a custom script to format the display of numerical values in reports and widgets. Here’s a approach to implement this:

1. Create a new Scripted Field:

  • Navigate to System Definition > Dictionary.
  • Add a new field of type "Scripted" to the pa_indicators table.
  • In the "Script"/calculated Value section of the new field setup, use the following JavaScript code to calculate the display value:
(function(current) {
    var num = current.value; // assuming 'value' is the field holding the numeric data
    if (num >= 1e12) return (num / 1e12).toFixed(2) + 'T';
    if (num >= 1e9) return (num / 1e9).toFixed(2) + 'B';
    if (num >= 1e6) return (num / 1e6).toFixed(2) + 'M';
    if (num >= 1e3) return (num / 1e3).toFixed(2) + 'K';
    return num.toString();
})(current);

Set the field to be "Read-only" and configure where it should be displayed.

2. Update Widgets and Reports

Modify any PA widgets, dashboards, or reports to use this new scripted field for displaying formatted values. This allows the existing data to remain unchanged and maintains system integrity while providing the custom display format your customer requested.

 

If my response has resolved your query, please consider giving it a thumbs up ‌‌ and marking it as the correct answer‌‌!

 

Thanks & Regards,

Sanjay Kumar Gupta

 

Hi Sanjay,

 

Really appreciate for your response.

Just wanted to confirm and make sure, I had updated the value in Number format from "kMGTPE" to "KMBTQQ" and it works very well. Is this fine or still I have to follow your guidance?

 

Regards,

Vinay Chaurasia

Community Alums
Not applicable

Hi @VinayC ,

I think this should be okay.

One thing you need to consider if in future going back to the previous format as well then you need to consider other ways to include both.

If my response has resolved your query, please consider giving it a thumbs up ‌‌ and marking it as the correct answer‌‌!

 

Thanks & Regards,

Sanjay Kumar