Hi Quinton,
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?
Hi Quinton,
Can you specify the OQL query that you want to create?
Cheers,
Jeffrey
Hi Jeffrey,
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.
Hi Quinton,
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:
https://docs.mendix.com/howto/monitoring-troubleshooting/debug-java-actions#1-introduction
If you are able to get the stack trace associated with the microflow error, could you please share it?
HI Quinton,
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:
https://docs.mendix.com/howto/extensibility/howto-datastorage-api (https://docs.mendix.com/howto/extensibility/howto-datastorage-api
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):
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
import com.mendix.systemwideinterfaces.core.IMendixObject;
public class getGUID extends CustomJavaAction<java.lang.Long>
{
private IMendixObject __item;
private ncm.proxies.Land_Holder item;
public getGUID(IContext context, IMendixObject item)
{
super(context);
this.__item = item;
}
@java.lang.Override
public java.lang.Long executeAction() throws Exception
{
this.item = __item == null ? null : ncm.proxies.Land_Holder.initialize(getContext(), __item);
// BEGIN USER CODE
return ORM.getGUID(__item);
// END USER CODE
}
/**
* Returns a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
{
return "getGUID";
}
// 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?
Any ideas?
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?
Any ideas?
Think the error is due to the matching of the types String to Long (returned from the getGUID)
SELECT
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
from NCM.Land_Parcels,
NCM.Parcel_Cover,
NCM.Opportunities,
NCM.Land_Holder
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?