how to write java action and return string value

0
hii members i am new in mendix i want to print to table for practise i have make a helper entity and set data source to a microflow of a data view on a page , microflow return the object of helper entity    in microflow i call a java action and and in java action set return type string  after click on deploy on eclipse i open the java file in Vs code      data view    text parameter of data view   microflow    java action    java action file    error     now i want to hwo can i make here my logic like core coding and want to reflect in mendix overview page  suppose i want to return a random number from here or a table of two from here  please guide me 
asked
1 answers
1

In StudioPro go to the Java action and on the bottom of java-action settings, there is the return-type parameter.

You currently have set this to String, which is why you have java.lang.String on line 23. You can change the return-type parameter to an Object, List or any of the other drop-down options. Then Run your app again. This will make the Java code get modified and a return variable will appear.

Now you can add your own code between

// BEGIN USER CODE
return "Some text";
// END USER CODE

and you have to make sure that your java-code returns the type that you have set the return-type to.

 

For more info check https://docs.mendix.com/refguide/java-actions/

For examples look at other java-actions for instance the ones in marketplace module Community Commons

 

answered