Forum Discussion

5 Replies

  • HamzaJ's avatar
    HamzaJ
    Data 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

     

     

  • AssafHanina's avatar
    AssafHanina
    Sisense 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:

    1. Open any Elasticube Data model
    2. Add Custom Table 
    3. 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

  • Hello JMANP00C

    I wanted to follow up to see if the solutions offered worked for you.

    If so, please click the 'Accept as Solution' button so other users with the same questions can find the answer faster. If not, please let us know so that we can continue to help.

    Thank you.

  • Hello JMANP00C,

    I wanted to follow up to see if the solutions offered worked for you.

    If so, please click the 'Accept as Solution' button so other users with the same questions can find the answer faster. If not, please let us know so that we can continue to help.

    Thank you.