apache-spark-sqlsubstringpalantir-foundrytext-formattingfoundry-contour

formating text to a new field in foundry contour


I need to transform text from one field to a new one. Currently the TEXTVALUE is "202411219999". The NEWVALUE to obtain must be like this: "2024-11-21"

I managed to use substring("TEXTVALUE", 1, 4) in the expresion function, getting first 4 characters from TEXTVALUE.

Do you know how can I use 3 substrings maybe in one expersion to obtain final "2024-11-21" ? I think palantir is using spark SQL for this.

Thank you


Solution

  • you can use concat to concatenate multiple substings,

    concat(substring("TEXTVALUE", 1, 4), '-', 
           substring("TEXTVALUE", 5, 2), '-', 
           substring("TEXTVALUE", 7, 2))