Storing the Mendix ID with an OQL query in a nonpersistent object.
0
I am wrestling with the correct OQL query. Currently I have this query: select Employee.id as Ref_Employee_ID ,Leave_status.HuidigSaldo as Balance_current ,Leave_status.InBehandeling as NotYetApproved from Verlof.HuidigVerlofstand as Leave_statusLeft join Leave_status/Verlof.HuidigVerlofstand_Medewerker/Basis.Medewerker as Employee When I run the query I get the error: com.mendix.modules.microflowengine.MicroflowException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.lang.NullPointerException: Could not find result association Ref_Employee_ID in target object. No I read that you could work around this by casting the ID. But I have trouble finding the correct syntac for this. I tried: select cast(Employee.id as string) as Ref_Employee_ID But seems not to be valid. select cast(.id as string) as Ref_Employee_ID seems to be valid but that casts the ID of HuidigVerlofstand instead of the employee. What am I missing? Regards, Ronald
asked
Ronald Catersels
2 answers
1
You were almost there. One tiny change you need to make: the word 'string' should start with a capital.
"select cast(Employee.id as String) as Ref_Employee_ID"
answered
Tim van Steenbergen
0
Do you have an association from the non-persistable object which is created by the OQL to the Basis.Medewerker ?
If not , add the association and use the association name instead then try again because Mendix doesn't allow you to minipulate the ID or add it as a attribute in the object.