The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
[Solved] Encode String as Base64
JEdward
RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 578 Unicorn
Hello,
I'd like to take an attribute value and encode it as base64, does anyone have any suggestions on how to do this using the Execute Script or another operator?
I'm struggling.
Thanks,
JH
I'd like to take an attribute value and encode it as base64, does anyone have any suggestions on how to do this using the Execute Script or another operator?
I'm struggling.
Thanks,
JH
0
Best Answer
-
JEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 578 UnicornSolved it! For anyone wanting to do the same, you can use the following code in the Execute Script operator.
ExampleSet eSet = operator.getInput(ExampleSet.class);
for (Example example : eSet) {
def s = example["Attribute Value"]
String encoded = s.bytes.encodeBase64().toString()
example["Attribute Value"] = encoded
}
return eSet;1