we want to use a certain Query in multiple locations on the MEGA Publisher WebSite. In order to avoid having to type the same EQL-Statement in different places (making changes cumbersome) we want to use a Query-Object to store the query. How can we use this Object (given its _HexaIdAbs, for example) in a [Component] tag to execute it and process its output?
If this is possible, is it also possible to "chain" a query as in
SELECT [Application] FROM (Query result here) WHERE [Short Name] LIKE "A#"
To get all Applications from a query whose name starts with A?
Thanks in advance.
You say "we want to use a certain Query in multiple locations on the MEGA Publisher WebSite"
This is not perfectly clear to me.
Can you describe better the situation you want to address (not the solution you would like to implement) with an exemple?
Let's say we have a filtering Query to find all relevant Applications, say all those who are productive. The _Select property of the Query (call it Applications_relevant) would be
SELECT [Application] WHERE [Lifecycle] = 'production'
Now say we want to make an Index of all Applications related to a certain Organisational Unit, but only the subset of relevant Applications is to be considered. This would mean we want
SELECT [Application] FROM (Applications_relevant) WHERE [OrgUnit] = &name
Whenever we decide to change the meaning of what is relevant, we don't want to change the latter SELECT as well, but still use the new query for what is relevant. A use case would be in the Index of Applications to have
SELECT [Application] FROM (Applications_relevant) WHERE [OrgUnit] = &name AND [Name] LIKE 'A#'
SELECT [Application] FROM (Applications_relevant) WHERE [OrgUnit] = &name AND [Name] LIKE 'B#'
SELECT [Application] FROM (Applications_relevant) WHERE [OrgUnit] = &name AND [Name] LIKE 'C#'
and so on
Now if we want to change Applications_relevant, we don't want to adapt all the 26 queries in the WebSite template as well. Instead we want to reference a common Query (Applications_relevant) in the template and change it in one place if the need arises to, for example changing the _Select for Applications_relevant to
SELECT [Application] WHERE [Lifecycle] = 'production' AND [Publish] = 'y'
Is that clearer now?
What we had expected to work was Something like
[Component="~asdf[Applications_relevant]"]... (HTML) ... [/Component]
[Component="SELECT [Application] FROM ~asdf[Applications_relevant] WHERE [OrgUnit] = &name"] ... (HTML) ... [/Component]
I am not aware that the syntax of tag works as you expected
However you can consider to use query sets
Thank you. Is there any way to Still use the Query object to hold the SELECT-Statement? Like
SELECT (Applications_relevant) INTO @apps
To create a query set, use 'Into' instruction
Select [Application] Into @ListApp
To keep query set after query execution add a 'keep' instruction in the query that builds the query set
Select [Application] Into @ListApp Keep @ListApp
Note: a query Q1 can have query code consisting of several select
To delete the query set , use 'Delete' instruction
Please reread the question. I am asking how to store this mechanic into a Query object and have it executed when starting the WebSite Generation process.
This could be either a Markup-Tag wich executes a Query given its ID, Name or Absolute ID or a way to connect Queries to the initialization Process so it is executed on initialisation of the Generator.
The instructions KEEP and DELETE are saved in the code of a ERQL query objects.
There are different options to trigger such queries before and after web site generation.
Thank you again for your help.
However we can't seem to specify wheter a Query linked via [Website].[Objects] is executed before or after generation; it is always executed before generation.
How can we alter the order there?
As mentioned in the KB, I would add a post generation script and add the code in there.
Most of the time we do work with batch scripts that actually execute the pre and post generation query's and do the website generation.