AWM and Apps - Database List - How to build the HQL Query

Hi,

I am trying to build some Database List with specific data in it.

How to build the HQL query to have the DatabaseList run properly ?

There is an example here.

But this example, without more explanation may be not enough info.

Note that the text of explanation is full of parenthesis, etc…
Those parenthesis : It looks like some embeded SQL queries (select … from select … , where… xxx=select… from…).

May I suggest to enhance it ?
With short sentences… clear presentation of elements involved to buid the query.

And to provide more explanations ?

Related to this context : how to provide the info, for the DatabaseList ?
The first column of the HQL query goes to the stored value in the AWM instance ?
The second column of the HQL query is used a label in the select component list ?

I guess so.
But nothing explain this explicitly in the doc nor the forum.


When exploring and searching, I made an error in the VALUE FIELD NAME.
In the 3 fields made for providing the data, in the most simple way (not the HQL).
I put “MyShort Text” with a space char in it, in VALUE FIELD NAME.

And … ho ho … the logs provide nice info.
It gives the HQL query that is built behind.
There is some interesting information.

2024-03-20 10:12:29,172 [qtp1208736537-1887 - http://myxwikiserver.lan:9018/xwiki/bin/edit/Boats/Code/BoatsClass?wizard=true] WARN c.x.x.o.c.DBListClass - Failed to get the Database List values. Root cause is [QuerySyntaxException: unexpected token: Text near line 1, column 74 [select distinct doc.fullName as unfilterable0, doc.fullName, doc.MyShort Text from com.xpn.xwiki.doc.XWikiDocument as doc, com.xpn.xwiki.objects.BaseObject as obj where doc.fullName = obj.name and obj.className = :className and doc.fullName <> :templateName]].

So you can see how the query is built by the AWM Database List component.

This is the most basic HQL query, to fill the Database List.


These links provides also a lot of interesting infos for howto do the HQL query.

The idea of using a Livetable as a detail list is nice.
Even though this does not allow to fill one of the AWM field.
(or I missed some point ?).

Here is a post where you can see a sample of “doc.objects(SomeClass)” :

To get some properties of the objec that is providing the infos of the document.

With this sample :

where doc.fullName <> 'XWiki.ArticleClassTemplate' and
  :category member of doc.object(Blog.BlogPostClass).category

Taken from the examples (link above,… “Query+Module#HQueryLanguageExamples”)

Hope it helps