If then statement
Hello,
I am trying to write an "if then" statement to generate an attribute. I would like to replace the ".0" in the attribute "partNOconcat" with "" (Nothing).
For example: partNOconcat : AA10000.0AA
i would like to replace it to give me in my new attribute the following; newGenAtt: AA10000AA
I currently have the following as my expresion:
if(partNOConcat contains(partNoConcat,".0"),replace(partNoConcat,".0",""))
This gives me the following error: "Syntax Error (implicit mulitplication not enabled)"
Please could someone provide me with some guidence to where I am going wrong.
Thank you,
Diella
Best Answer
-
diellasingh Member Posts: 7 Contributor II
Hi Thomas,
Thank you for your fast response time. I didn’t know that was possible to autopopulate a process from XML.
About the syntax provided. I am not retrieving the desired output. I’m struggle to construct the third argument. Whereby I would like the value of the generated attribute (dot_zero) to have the attribute value of the [temp] for that particulate example if ".0" is not found within the [temp] attribute value.
Syntax: if(contains(".0",partNoConcat),replace(".0",partNoConcat,""),partNoConcat)
Please could you tell if this is even possible with the If function expression in RM.
Thanks,
Diella
0
Answers
Your syntax is a bit off. Here's an example.
Hi Thomas,
My coding level is fairly low, therefore I dont really understand the XML. So would you be able to show me the functional expression type out rather than in XML.
Thanks,
Diella
The XML is the process I built to illustrate how to do it. You can paste it into the XML view and the process will autopopulate, it's a handy way to share processes in RapidMiner.
If you juste need the syntax here it is: if(contains(".0",[temp]),replace(".0",[temp],""),"RapidMiner")
Hi,
And for future reference, here is a link describing how you can import this XML code into RapidMiner to get your visual process: http://community.rapidminer.com/t5/RapidMiner-Studio-Knowledge-Base/How-can-I-share-processes-without-RapidMiner-Server/ta-p/37047
Cheers,
Ingo