Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Scripting- Java script with "contains" Function

$
0
0
Hows it going guys! Happy New Years to you all! I have a quick question that I hope someone can help. I never learned java so im not good at writing java script. I taught myself the basics but this question would not be under the basics of java :(

Question:
I have 2 column of data that I need to make a simple "IF Statement" script.

Column 1 contains text: For example "EUSA", "NASA", "AFSA", "EUAF", and etc. (one text per row)
Column 2 contains text: For example "ITCL", "USPE", "USIT","BRCL", and etc. (one text per row)

My two "IF Statements" would need to be:
Column 1 must be equal to "EUSA"
and
Column 2 must contain "CL" within the text. EX) "USCL" or "ARCL"

If these both statements are true then bring me back a new variable called TEST with this text in that column "EUCL" if false then bring back "BLANK"

This is my script so far: I've gotten the first part of the script down but need help with a "contain" function.

var TEST

if(Column1.getString()=="EUSA" && **){TEST = "EUCL"}
else{TEST = "BLANK"}


Im guessing the ** needs to be something like Column.2.contains "CL"? I cant find it anywhere on the internet and i have a massive headache now :mad:

I would really appreciate your help! Thank you! Kettle on!

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>