AnsweredAssumed Answered

equation to place commas in list properly

Question asked by JulianClayton on Dec 10, 2010
Latest reply on Dec 10, 2010 by JulianClayton

Title

equation to place commas in list properly

Post

I have a list that appears in a report that shows which of the items 1-42 have a specific entry.  The only way I can find to write the calculation is to either put a comma after or before every number except the first or the last number.  The problem is if the first or last number aren't included in the list I get a comma hanging out there for no reason and it makes the report look sloppy.  Here is a sample of what I currently use where if #1 isn't in the list the entire list is preceded by a comma.

//Spares calc

If ( ${1} = "Spare" and panelSize ≥ 1 ; "1" ; "" ) & 
If ( ${2} = "Spare" and panelSize ≥ 2 ; ", 2" ; "" ) & 
If ( ${3} = "Spare" and panelSize ≥ 3 ; ", 3" ; "" ) & 
If ( ${4} = "Spare" and panelSize ≥ 4 ; ", 4" ; "" ) & 
Does anyone have a better option?

Outcomes