I have attached a snippet of the table. I want to replace the “N” in Rule_Name column with whatever value is in PARAM1 column and Replace the “X” with Param2. In absence of X I just want to replace the “N”. Can anyone help to solve this problem and waht to use?
You should be able to do this with a nested string replace.
replace(replace(column("RULE_NAME"),"N", column("PARAM1")), "X" , column("PARAM2"))
I’d use a Column Expressions. I like storing the intermediate output as variables because it makes things easier to read:
a = replace(column("RULE_NAME"),"X",column("PARAM2")) b = replace(a,"N",column("PARAM1"))
Thank you…it worked
I like the solutions provided above. Just be careful of using “N” without the space since you might get unexpected outcomes. I would use "N ".
Thank you it worked.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.