formula in if statement


I have a property control (List Box) that I want to use as a parameter to influence the behaviour of a visualization.

The property control is called myControl and can only have values 1 or 2.

The Y axis of my visualization has the formula:   $map("Sum($esc(${multiperiods}))", ",")   ,where multiperiods is a String List that can assume values 3D,4D,5D,6D


I am trying to include the property control in this way:

$map("Sum($esc(${multiperiods}))", ","),


Unfortunately Spotfire is not very happy with the formula and complains with an "Expected ')' but found ',' on line 2 character 30. Which is curious because there is no ',' in that position, but indeed a ')'.


Anyway in pseudocode, my plan was to implement the following:

IF myControl = 1 -> display my original formula ($map...)

IF myControl = 2 -> do something else (for the time being I simply output the value "2")

Can anybody help me implementing it in spotfire?


(1) Answer