What you can do is before you call the Retrieve OQL Dataset is to get the GUID of the Land_Holder object using the Java action getGUID from the Community Commons module.
The use that in your query as follows: WHERE NCM.Land_Holder.ID = $LandHolderGUID.
I have followed the document to the letter, the only thing I’m questioning now is Core.createOQLTextGetRequestFromDataSet method described below. Is this something I need to import or is it already a core component of Mendix?
Can you specify the OQL query that you want to create?
The OQL query returns data as I can see it in a report widget, however if I add the parameter (NCM.Land_Holder.SBI = $LandHolder.SBI) it errors.
This is the first issue.
Any ideas on the second issue where the Microflow fails?
This just gives a type mismatch from string to object
If I edit the Parameter I only have the option of Object / Boolean etc. I can’t access the attribute here…
It’s looking for an attribute from the error message.
Regarding Q2, could you share the stack trace for the runtime error associated with the Microflow?
Another option that would allow you to further debug the issue, especially in this case since you are calling the Java Action “Retrieve Dataset OQL”, is to debug the java action using eclipse following the steps provided in the following Mendix Doc:
If you are able to get the stack trace associated with the microflow error, could you please share it?
Looking at the stack trace I noticed that is complaining about something not being implemented:
Any possibilities that a step could have been missed while following this document:
This is now resolved - I was missing that I had to edit the .java and add the code as shown in the screenshot. Newbie error and big thanks to Mendix support. If anyone else is struggling then use the mendix runtime library to find the correct import modules that relate to the code functions.
not sure that i’ve set this up correctly as the Java compiled at runtime shows two items (item and __item):
public class getGUID extends CustomJavaAction<java.lang.Long>
private IMendixObject __item;
private ncm.proxies.Land_Holder item;
public getGUID(IContext context, IMendixObject item)
this.__item = item;
public java.lang.Long executeAction() throws Exception
this.item = __item == null ? null : ncm.proxies.Land_Holder.initialize(getContext(), __item);
// BEGIN USER CODE
// END USER CODE
* Returns a string representation of this action
public java.lang.String toString()
// BEGIN EXTRA CODE
// END EXTRA CODE
Here is the Microflow – passing the parameter of the LandHolder context
Here is the Microflow view with the parameter of the LandHolder object context passed – can’t see why it has the security issue?
Here is the Microflow – any ideas why the security is an issue. I’ve checked the Community Commons security and there is nothing obvious there?
Think the error is due to the matching of the types String to Long (returned from the getGUID)
NCM.Land_Parcels/Parcel_Name as OB_Parcel_Name,
NCM.Land_Parcels/ParcelID as OB_ParcelID,
NCM.Land_Parcels/Area_ha as OB_Area_ha,
NCM.Parcel_Cover/LC_Description as OB_Land_Cover,
NCM.Parcel_Cover/LC_Land_cover_class_code as OB_LC_class_code,
NCM.Opportunities/Opportunity_name as OB_Opportunity_Name
WHERE NCM.Land_Parcels.sbi = NCM.Land_Holder.SBI
and cast(NCM.Land_Holder.SBI as Long) = $LandHolderGUID
and NCM.Parcel_Cover.LC_SBI = NCM.Land_Holder.SBI
and NCM.Parcel_Cover.LC_Parcel_id = NCM.Land_Parcels.ParcelID
and NCM.Land_Parcels.Area_ha > NCM.Opportunities.Min_acre
and NCM.Opportunities.Criteria_plant_trees = NCM.Land_Parcels.Objective_plant_trees
I’ve created the getGUID java Action (Community Commons) in a microflow and the next step runs the OQL query but it’s not filtering the OQL query by the GUID. Any ideas?