Hello community,
I'm looking for a COMPLETE example to create a view with fetchXML.
There are "only" little snippets of example ... or I'm didnt the right search. Didnt found a complete example :-(
My construct is following:
- MainEntity named "project". Primary key is a projectnumber.
- Any project has orders (entity order, pk ordernumber) n orders :1 project
- Any order has jobs ( entity job, pk jobnumber) n jobs : 1 order
Three levels I would say.
Aditional there are entities, I named cataloques, which contain ressources.
- like cars. Any car can be related to a job, relation 1:n
- like places which are related to jobs, also 1:n
and some more ...
Now I want to create lists of projects.
- Click a project all related orders should appear with their data from cataloque-entities.
Same for orders with jobs.
And of course the other way from jobs showing related order and project.
After some days of reasearch, I'm able to fetch a single entity:
[Web Template]
{% fetchxml project_query %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="cre48_prject">
<attribute name="cre48_projectnr" />
</entity>
</fetch>
{% endfetchxml %}
<ol>
{% for result in project_query.results.entities %}
<li>
GUID: {{result.cre48_projectid}}<br>
No. {{result.cre48_projectnr}}
</li>
</ol>
Also filtering to a single project works fine i.e. project-no. 12345:
<filter type="and">
<condition attribute="cre48_stprojectnr" operator="eq" value="12345" />
</filter>
And same works for list of orders and jobs.
Now, my important problem:
<link entity> fails, when I try to collect data from related entities. Neither cataloques nor parents or childs give results.
In some cases nothing will be found.
In some cases a liquid error appears: Liquid error: Exception has been thrown by the target of an invocation.
When project_query is extended with
- from
- to