Need a special offer?Find out if your project fits.
+

Any way to format a negative measure (currency) to look like positive measure (currency)?

Re-Open
Bill Kaper asked on October 9, 2023

So let me explain what I'm doing here:
I'm building a ledger view (accounting) that aggregates positive and negative numbers and shows the output of that aggregation. However, I want to then show the number as a positive number (no matter what) and show a label beside the number that indicates for the specific account, if it is a debit or a credit. In accounting, Asset accounts are increased by debits and decreased by credits but liabilities are increased by credits and decreased by debits. 
I've made this magic happen by creating a column based on the account type that has the string CREDIT::DEBIT or DEBIT::CREDIT based on if the account is increased by a credit or increased by a debit. I then take my positive and negative numbers and aggregate them together in the measure via a SUM. Finally, I use the customizeCell API after the report loads and go row by row stripping away the part I don't want from the dimension's label so I'm left with CREDIT OR DEBIT based on the resulting sum aggregation result being positive or negative (I used getCell to get the measure on the row and use it's value to make it happen).
Here is where I'm stuck. I then want the measure to display as a positive number no matter what. However, I need its value to be either positive or negative to drive the string manipulation I just described above. I can think of a few solutions:
1. Just choose a negative number display format that makes the number look no different than a positive number (doesn't existing in your documentation).
If I change the negativeCurrentFormat to "$1", while it does display a positive number (no negative number formatting), it doesn't show the currency symbol. This is probably a bug in that it shouldn't accept the format at all, but PLEASE don't fix that bug by closing this loop as it will break how I have this working now. 🙂  I'd ask that you consider adding support for displaying a negative number as currency without any negative denotation.  
2. Pull the value from a measure not being displayed in the grid. I suspect any measure not on the grid isn't calculated, so unless you tell me that's possible, I'm assuming it's not. 
Thanks,
Bill

6 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster October 11, 2023

Hello, Bill!

Thank you for writing to us.
After reviewing your request, our team has decided to add a currency formatting setting to hide the minus sign from negative numbers. This feature will be included in one of the upcoming minor releases, ETA Nov 13th.
Please let us know if any other questions arise.

Best Regards,
Maksym

Public
Bill Kaper October 11, 2023

Nice! Thank you!
 
-Bill

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster November 13, 2023

Hello Bill,

We are pleased to inform you that new formatting options "$1" and "1$" were added to the negativeCurrencyFormat property. Also, a new formatting option "1" was added to the negativeNumberFormat property.

This feature is included in the 2.9.64 version of Flexmonster: https://www.flexmonster.com/release-notes/version-2-9-64/ 

You are welcome to update the component. Check out our updating tutorial for guidance: https://www.flexmonster.com/doc/updating-to-the-latest-version/

Please let us know if the feature works. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Bill Kaper November 13, 2023

Hi All,

So I was able to verify that the new negativeCurrencyFormat is working when a currency symbol is specified. Thank you!

However, I tried removing the currency format and tested the negativeNumberFormat, and that wouldn't work for some reason. I'm assuming when the currencySymbol properly is an empty string, the field should look to the negativeNumberFormat to indicate how to show the negative number?

-Bill

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster November 14, 2023

Hello Bill,

Thank you for the feedback.

Kindly note that if the currency symbol is not defined, Flexmonster uses the negativeNumberFormat. Please check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/g7oL3vjb/ 

You are welcome to contact us in case other questions arise.

Kind regards,
Nadia

Public
Bill Kaper November 14, 2023

I see it works in your example. It must have been me messing something up in my testing. I use currencies so either way I'm good. Thank you guys so much for putting in this enhancement. Much appreciated!

-Bill

Please login or Register to Submit Answer