String to Enumeration conversions

0
I am using Java action EnumerationfromString and I receive an error  com.mendix.core.CoreException: com.mendix.modules.microflowengine.MicroflowException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.util.NoSuchElementException: No value present     at Main.Act_ReopenOutofScope (JavaAction : 'EnumerationFromString') Is there anyway to convert String into Enumeration MEndix Version 7.23.19  
asked
3 answers
0

Hi Ishani,

If you check the documentation of this Java action you can read the following: 

Use this Java action as a template for your own String-to-Enumeration conversions.
Studio Pro requires specifying the exact Enumeration to return in the definition of a Java action so we cannot provide a generic implementation.
This implementation will throw a NoSuchElementException if an invalid toConvert parameter is given, so remember to handle this error gracefully.

So you need to insert an string that exactly matches an enumeration value or otherwise handle this error to use this Java action.

answered
0

The error you’re seeing is because it has been unable to find an enumeration for that string value. 
https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#get--

I think you need to check your spelling and if you are passing a valid value to the Java Action.

Good luck

answered
0

Yes there is. Two ways. See the solutions provided by Bart Rikers and another by Ronald Caterels in https://forum.mendix.com/link/questions/102428. Use whichever solution works for you.

answered