Forum Discussion
5 Replies
- HamzaJData Integration
Hello JMANP00C
I am a bit confused. Your screenshot is throwing me of 🙂 The highlighted code does not have a relation with the error you are getting when parsing the code.
If you want to remove special characters, then I think you have to it per character. You can do this with the function replaceAll() and CHAR(). For example CHAR(13) is a linebreak (carriage return)
Hope this helps
Hamza
- JMANP00CData Storage
hope anyone can help
- AssafHaninaSisense Employee
hey JMANP00C ,
It looks like you want to remove the text pattern '[^a-zA-Z ]' from the Policy Owner Name column.
The Substring function slices a string from the beginning based on the index. Instead, please consider using the Replace All function to replace the specified pattern with an empty string.
Please find an Example:
- Open any Elasticube Data model
- Add Custom Table
- Paste the SQL Below and Preview the Outcome
select example_a, example_b, example_c, strparts(example_a,'$',1) as remove_before, -- strsparts which remove the text before the special character strparts(example_a,'$',2) as remove_after, -- strsparts which remove the text after the special character SubString(example_b,5) as sub_string, -- extract the substring based on the index ReplaceAll(example_b,'[a-z,A-Z]','') as replace_with_empty_String, -- replace all occurroneces of the old string with new string. ReplaceAll(example_c,'[a-z,A-Z]','$') as replace_with_special_charcater from ( select 'text_to_remove_with_special_charchater_$!@' as example_a, 'example_[a-z,A-Z]' as example_b, 'example_[a-z,A-Z]_test' as example_c ) a
Best Regards