Search code examples
multiple-columnsspotfire

extract text between two strings in Spotfire


I want to calculate a new column on Spotfire from data below:


Solution

  • Here is what you want, you just have to replace "Column" by the name of your column.

    Mid([Column],
        Find("out of ",[Column])+Len("out of "),
        Find(" exposures",[Column])-Find("out of ",[Column])-Len("out of ")
    )
    

    Little explanation:

    Mid allows you to extract a substring from a string and two positions/indexes.

    Find allows you to get the index of the first match of the first argument into the second.


    You can find more details about text functions of Spotfire here: https://docs.tibco.com/pub/spotfire/6.5.2/doc/html/ncfe/ncfe_text_functions.htm