Request for conditions for "category" in the Wordpress Piece

I have 7 different categories I want to be able to post to, based on what category I have written in a Google Sheet.

Now I solve this by using BRANCH to sort between 7 different Wordpress pieces, where the only difference between these pieces is which category I have chosen.

It would be so much nicer if I could just add conditions inside the WP piece:
If variable A contains “Funny”, then use category “Fun stuff”
if variable A contains “Cups”, then use category “Kitchen”
if variable A contains “Tax”, then use category “Business”

etc.

This may not sound like much, but when building out flows for as many sites as I do all the numbers adds up. :sweat_smile:

That would make the Flow diagram so much easier to build, probably use less data power/ memory , and also quicker :slight_smile:

if it is just only the category, best thing atm would be a code step:

export const code = async (inputs) => {
    if(inputs.text?.contains("Funny"))
    {
        return "Fun stuff"
    }
    else if (inputs.text?.contains("Cups"))
    {
        return "Cups";
    }
    else if (inputs.text?.contains("Tax"))
    {
        return "Business";
    }
    //write more conditions here
    return undefined
};

@Abdul , thank you.
How do I get for instance value “B” from a Google Sheet into this script?

And how can I use the result from this code step into a Wordpress piece?

I have programmed a tiny bit in PHP and Javascript before, but am depended on good documentation and/ or examples. :sweat_smile:

Like this