Replace mutliple att. values in function for Generate Attribute

fatou_ceesay
fatou_ceesay New Altair Community Member
edited November 5 in Community Q&A

Hi

I am trying to generate an attribute by text tranformation function. Below is my function:

replace(grade, "[75 - 100]", "Excellent"
 ,replace(grade, "[60 - 70]", "Very Good"
 ,replace(grade, "[40 - 50]", "Good"
 ,replace(grade, "[30 - 35]", "Poor"))))

 

I get Error: The function 'replace' must have 3 arguments but has 4.

Please assist.

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee

    Hi,

     

    did you try Map or Replace operators? Feels like they are more suited.

     

    Cheers,

    Martin

  • fatou_ceesay
    fatou_ceesay New Altair Community Member

    Yes I have tried replace and map operators but they replace the values in the original attribute.

    What I want is to have the values replaced in a new attribute.

  • Telcontar120
    Telcontar120 New Altair Community Member
    You could Generate Copy of the original attribute first, and then Map or Replace as desired. That would let you both keep your original attribute unchanged and have the new values you want.
  • gmeier
    gmeier New Altair Community Member

    Hi,

     

    alternatively you could also fix your function like this

     

    replace(
        replace(
            replace(
                replace(grade, "[30 - 35]", "Poor"),
             "[40 - 50]", "Good"),
         "[60 - 70]", "Very Good"),
     "[75 - 100]", "Excellent")