## Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.

• HOW TO ADD COMMA IN A CALCULATED FIELD

# HOW TO ADD COMMA IN A CALCULATED FIELD

Community Beginner ,
Aug 03, 2021 Aug 03, 2021

Copied

Hi,

I want't to add a comma to my calculated field. Here's my case, I have summed a column but got a result of Php 34999.89 instead of a number with comma (Php 34,999.89). I can't edit the formatting becuase I already added a custom format script. Can you help me with my script or do you have other ideas how to do this? Please see attached picture for reference. Thank you.

TOPICS
Comment review and collaborate PDF, Create PDFs, Edit and convert PDFs, General troubleshooting, How to, JavaScript, PDF forms

Views

40

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adobe Community Professional , Aug 03, 2021 Aug 03, 2021
Try this code: var x = event.value; var n = x.toString().split("."); n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); if(event.value == 0) event.value = ""; else event.value = "Php "+ n.join(".");

Likes

2 Replies 2
Aug 03, 2021 Aug 03, 2021

Copied

Try this code:

var x = event.value;
var n = x.toString().split(".");
n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
if(event.value == 0) event.value = "";
else event.value = "Php "+ n.join(".");

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Aug 04, 2021 Aug 04, 2021

Copied

LATEST

It worked. Thank you very much.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources