Formatted
prop("Sales")
.map(
lets(
/* If true, 20.00 shows as $20, otherwise use decimals ($20.00) */
simple, true,
/* Number of significant places */
decimals, 2,
/* First round the amount */
amount, current.prop("Amount").round(decimals).format(),
/* Split into dollars and cents */
amounts, amount.contains(".") ? amount.format().split(".") : [amount],
/* Add commas */
dollars, amounts.at(0).replaceAll("\\B(?=(\\d{3})+(?!\\d))",","),
/* Cents */
cents, amounts.at(1),
/* Format the return */
"$" + dollars + (cents.empty() && simple ? "" : "." + cents.padEnd(decimals, "0"))
)
)
.join("\\n")
FD Sales
FD Aggregation