View Entities, OQL Select All From Entity

0
Hi   I am using the new View Entity functionality and want to be able to select everything from an Entity.  According to the documentation I should be able to just use the standard   SELECT * FROM CaseManagement.CaseManagement   However I get an error on the Select statement as below: All columns of the first select query must have a correct name: An attribute must have a simple name or an alias.   I have tried changing it to include an alias   FROM CaseManagement.CaseManagement SELECT CaseManagement.CaseManagement/* as cm   However I still have an error, com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"amount":-1,"oqlQuery":"SELECT cm FROM (FROM CaseManagement.CaseManagement\r\nSELECT CaseManagement.CaseManagement/* as cm) LIMIT 20","offset":-1,"type":"RetrieveOQLDataTableAction"}', all database changes executed by this action were rolled back   Am I missing something or am I going to have to call out each attribute individually?  I'm on v10.23   Thanks Grant
asked
2 answers
6

Hello Grant Finlay,

 

You can use like below.

select         

 INVITE.InviteCode AS InviteCode,    

 INVITE.CustomerLastName AS CustomerName,        

INVITE.DateSent AS DateSent,        

INVITE.InviterFullName AS InvitedBY,        

CUSTOMER.CompanyName As CompanyName,        

CUSTOMER.SubmissionDate AS SubmissionDate ,        

BRAND.BrandName As BrandName ,      

CASE           

   WHEN STATUS.Meaning=NULL THEN INVSTATUS.Meaning           

        ELSE STATUS.Meaning           

            END AS Status,       

ACCOUNT.FullName  AS AsssignedTo   

FROM MDM_Customer.Invite  INVITE     

LEFT OUTER JOIN INVITE/MDM_Customer.Invite_CustomerAccount/MDM_Customer.CustomerAccount AS CUSTOMER    

LEFT OUTER JOIN INVITE/MDM_Customer.Invite_BrandsMaster/BrandManagement.BrandsMaster AS BRAND    

LEFT OUTER JOIN CUSTOMER/MDM_Customer.Application_Status/LookUp.LookUpCodes AS STATUS     INNER JOIN INVITE/MDM_Customer.Invite_Status/LookUp.LookUpCodes AS INVSTATUS     

LEFT OUTER JOIN CUSTOMER/MDM_Customer.CustomerAccount_Account/Administration.Account AS ACCOUNT 

where 1=1 

answered
0

Hi Grant,

 

Unfortunately, I think that you need to name (give an alias) to all the columns.

This is to make sure that the attributes on the View Entity don't have duplicate names when joining tables.

For example, if you join the Entity Company and Entity Employee and both have an attribute Name, you need to specify which one belongs to the associated entity (at least on the version you are using, that I believe that follow OQL v2).

 

Even this is a simple SELECT of a single Entity, it might not work.

 

Let us know if you find another workaround to select all the attributes.

 

Regards,

Daniel

answered