🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Hi all! How can I replace words?

User: "GeorgeOik1999"
New Altair Community Member
Updated by Jocelyn
 It is not practical to Map one by one all the values , so I want to replace the words with numbers. When I see TV Horror I want to be 15 all the example and TV Dramas=4. Is there any faster way ( some regular expresion ) that will replace the whole example? 

Find more posts tagged with

Comments

Sort by:
1 - 2 of 21
    User: "Caperez"
    Altair Community Member
    Hi @GeorgeOik1999

    have you try with the replace function of Generate Attribute?, something like this  may be useful

    replace(text, "TV Horror", "15")

    Best, 

    Cesar
    User: "kayman"
    New Altair Community Member
    If you use the suggested solution by @ceaperez you might be better of using the replace with dictionary operator, as this may spare some room on your screen if you have lots of labels. But in the end you don't fix your problem I think, all you have will be that your text is replaced with a number, so the mapping issue will remain.

    Another option might be to combine a couple of things, you could use the split operator on your [listed_in] field, and split on , (comma space). next you could loop through all your attributes, filter out all empty ones and you'll be left with a nice list of single entries 

    So TV Horror, Teen TV shows will first become 

    Att1              Att2
    TV Horror    Teen TV Shows

    and then

    TV Horror
    Teen TV shows
    ...