-
Goal: After importing a CSV, I' m trying to edit a newly created column based on other columns. One of the conditional columns is a string but I cannot get the javascript Ternary operator correct for the new column Value.
-
Steps: Imported a CSV with titles into a TransactTableFields table and added a column calc_NetValueChangeAmt. I can do a simple formula like this to make the number the negative value of another column (Amount):
-{{ currentSourceRow.Amount }}
But I would like to only make the number negative if another column BuySellIndicator is equal to the letter "B".
I tried this code but it doesn't work:
({{ currentSourceRow.BuySellIndicator }} === "B" ) ?
-{{ currentSourceRow.Amount }}
:
{{ currentSourceRow.Amount }}
So if BuySellIndicator is B, set calc_NetValueChangeAmt = negative Amount, otherwise set calc_NetValueChangeAmt = Amount
- Screenshots:
I want this calc column to be negative Amount if a BuySellIndicator is = "B"
Trying as BuySellIndicator === 'B' (instead of "B") and displaying as string
This sets the Calc field equal to all negative Amount:
BuySellIndicator is a String = B or S or blank
Amount is formatted as Currency
calc_NetValueChangeAmt is type Currency but the source is blank
The value returned is zero when I expect a negative Amount
Thanks for your help learning this.