Changing values of Objects attributes using Java Action
Hello, I want to loop through the attributes of an Object and set all empty Strings ( “ “ ) to null. The Code works perfectely as long as I create the Set of keys manually (picture1). When I use the command “keySet” the code does not work anymore (picture2). I guess it has something to do with the fact that the created Set just supports “remove” operations during an iteration. Is there any way to overcome this problem? I already tried multiple methods to loop through the attributes but they don’t succeed eigther. I would be really pleased about some help! picture1 picture2
Just checked: your code from picture 2 runs fine when passing an entity to the Java action (as Type parameter), ending up with Strings that are empty. I inspected this in the Mendix debugger.
Not sure what you want to achieve in the line above // BEGIN USER CODE, but please notice that everything outside of //BEGIN… and //END.. and // BEGIN EXTRA CODE, //END EXTRA CODE will be removed when triggering a “Deploy to Eclipse” from Studio Pro next time.