Skip to main content
Question

Formula to add numbers and display in a list

  • October 22, 2019
  • 0 replies
  • 52 views

I have 4 numeric fields that I need to 1, add together and 2, display in a vertical list only if they exist. If they dont exist I want it to be collapsed. 

The formula I have got to complete the second part is: 
"<span style=\"font-size:11px;\">" &
"<b>" &

var text VerticalList =
(List
("<br />$",
ToText(([Cost Notes])),
ToText([Note 2 Cost]),
ToText([Note 3 Cost]),
ToText([Note 4 Cost])));

If($VerticalList <> "",
"$"
& $VerticalList)

& "</b>"
& "</span>"

To get a value of 0 to not show up though in this list I have to uncheck " treat as 0" in those fields. 

The problem im running into is then I cant add them into one total cost because ive unchecked treat as 0. 
But if I checkmark that my list displays, lets say Note 4's costs as $0 which I dont want.



------------------------------
Mike Klausing
------------------------------
This topic has been closed for replies.

AdamKeever1
Forum|alt.badge.img+2
  • Registered
  • October 22, 2019
Try adding some if statements:
"<span style=\"font-size:11px;\">" &
"<b>" &

var text VerticalList =
(List
("<br />$",
IF(ToText([Cost Notes])=0,"",ToText([Cost Notes]),
IF(ToText([Note 2 Cost])=0,"",ToText([Note 2 Cost]),
IF(ToText([Note 3 Cost])=0,"",ToText([Note 3 Cost]),
IF(ToText([Note 4 Cost])=0,"",ToText([Note 4 Cost])));

If($VerticalList <> "",
"$"
& $VerticalList)

& "</b>"
& "</span>"​

If the "" syntax doesn't work, try to replace that with null.

------------------------------
Adam Keever
------------------------------