Regular expression for evaluating multiple value columns in a CSV file - SmartPlant Foundation - IM Update 48 - Help - Hexagon

SmartPlant Foundation Help

Language
English
Product
SmartPlant Foundation
Search by Category
Help
SmartPlant Foundation / SDx Version
10
SmartPlant Markup Plus Version
10.0 (2019)
Smart Review Version
2020 (15.0)

You can create a regular expression in a computed column and use it to evaluate the data pattern in columns which have multiple values in your CSV file.

Example

Scenario: The data in two multiple value columns need to be compared and validated.

MultipleValueColumn1 – This column contains multiple values which need to be compared with the values in another column.

MultipleValueColumn2 – This column also contains multiple values which need to be validated against those in the MultipleValueColumn1.

To evaluate the two columns, create the following computed columns:

RegExPatternForValidation - This creates the required regular expression pattern from the column, MultipleValueColumn2, in the CSV file:

func.Concat({"^(?=.*", func.Replace([MultipleValueColumn2], ",", ")(?=.*"), ").*$"})

ValidateColumnValues - This uses the regular expression pattern to compare the values in MultipleValueColumn1 and MultipleValueColumn2:

func.Decode(func.RegexMatch([MultipleValueColumn1],[RegExPatternForValidation]), {"False", "False"}, "True")

Result: If the values provided in MultipleValueColumn2 matches with the values present in the MultipleValueColumn1, the ValidateColumnValues computed column returns the value as True.