Transform Script

Priya123
Tera Contributor

Requirement: 

 

spreadsheet column A has set of Values like sample " ccPlus", "ccSCO" etc. 

Need to update the target Table (choice list) with values like " If column A contains Plus" --> The target table should be populated with Value 1. if If column A contains SCO " --> The target table should be populated with Value 2  etc

 

Any leads ?

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@Priya123 You should have your tranformEntry script as follows.

Screenshot 2023-10-13 at 11.56.39 PM.png

answer = (function transformEntry(source) {

    if (source.column_A.includes('Plus')) {
        return 'Value 1';
    } else if (source.column_A.includes('SCO')) {
        return 'Value 2';
    }

})(source);

Hope this helps.

Thank you Sandeep but doesnt the includes stmt return only true or False.. cos am using includes as well but since its a lot to check, i have to give a really long check condn to set the value cos it returns either true or False... tried the above one, but am unable to use the return Value in further if stmts..