How to convert the type from Decimal to  IMendixObject in Java action?

0
Hi. I want to make a list using input parameter which has type of Decimal in Java action. Java action need to return  a List of IMendixObject. I learned about that I have to use the Core.instantiate (?) method to create a concrete object of the correct type. But Mendix says this method isn’t correct. Which method is correct to convert the type from Decimal to  IMendixObject?  
asked
2 answers
2

If you want to instantiate an object in Java you need to pass the full qualified name like ‘MyFirstModule.Customer’  You can not instantiate with a Decimal.

Probably you have created an entity that should contain the values. Like ‘MyFirstModule.DecimalParameter’ with two attributes of type Decimal ‘UnderStatusParam’ and ‘OverStatusParam’.

Use the proxy is easier.
 

DecimalParameter decimalParameter = new DecimalParameter(getContext());

decimalParameter.setunderStatusParam(underStatusParam);
decimalParameter.setoverStatusParam(overStatusParam);

returnList.add(decimalParameter.getMendixObject());

Please note: this is pseudocode, not checked.

BTW This could be easier achieved in a microflow.

 

answered
0

Thank you for the information.

Visit: Java Course in Pune

answered