Search code examples
transformationspotfire

Spotfire to transform text value before loading


Folks,

I've column [A] with various texts and need to transform that text (i.e., replace with abbreviations) before loading.

So, a table has values: J1, J2, J3, PLAB, CIVIL, ENGG etc.

I need to transform it to "J1" to "Java", "J2" to "Stack", while keeping the PLAB, CIVIL & ENGG as they are.

Hope I am clear.

PS: I don't need a calculated column, as column [A] has other text that does not need transformed.


Solution

  • This can be done when you add the data table to the analytic.

    • File > Add Data Table > (Select your data)
    • At the bottom of the window, you will see Transformations... select Calculate and replace column
    • Add the expression below, and give it the same column name as the original column
    • Select OK

    Custom Expression:

    case
       when [yourColumn] = 'J1' then 'Java'
       when [yourColumn] = 'J2' then 'Stack'
       else [yourColumn]
    end