oql query not working

0
based on examples in document  i tried to run a oql query to get row count of an attribute, but it gives error “missing EOF at ‘,’ “   need help with correct query, finding it difficult to identify the right syntax   
asked
4 answers
2

John,

My gut feeling says that you are only using OQL to get a count of a specific set of data. And you use OQL because you can.

But when you really want to use Mendix the best way; only use OQL if the default used query language XPath isn’t sufficient.

In your example I don’t see any need for a OQL query.

Add an activity

→ Type: Retrieve

→ From database

→ select the required Entity

→ Add XPath constraint if needed to define the subset of that entity

Add a second activity 

→ Type: Aggregate

→ Select the output list of preceding activity

→ Count

Done

These two activities, although modeled separately will be executed as a direct Count Select query. Returning only the Count as primitive Integer value.

Benefit; no need to hassle with OQL syntaxes and fellow Mendix developers also understands what you are doing.

answered
0

Lose the braces around “VM” and replace single-quotes by doublequotes. Also, you are adding this OQL to the ‘Execute OQL Statement (count Rows)’ so you can (should) lose the count (*) too. Also the parameter won’t get accepted. Insert the modulename.tablename surrounded by doublequotes.

Btw. you can test OQL-statements by dragging the snippet OQL into some page or by going to https://mydemoversion8-sandbox.mxapps.io/p/OQL

**Edited**

An example:

answered
0

 

updated query still errors out , i am also not able to find a good document on oql syntaxes on the website..

 

answered
0

What are other ways of finding count of an attribute ( which is string) 

i tried using the aggregate but that does not list the attribute for count.  

answered