Welcome Dialog

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

Community Beginner ,
Aug 03, 2021 Aug 03, 2021

Copy link to clipboard

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.

 

kmbt345_0-1628041329984.png

kmbt345_1-1628041362396.png

kmbt345_2-1628041496881.png

 

 

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

Views

40

Likes

Translate

Translate

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 guidelines

correct answers 1 Correct answer

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

Translate

Translate
Adobe Community Professional ,
Aug 03, 2021 Aug 03, 2021

Copy link to clipboard

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

Translate

Translate

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 guidelines
Community Beginner ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

LATEST

It worked. Thank you very much.

Likes

Translate

Translate

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 guidelines