0

Here are the details of schemas:

Schema 1 :

  • field 1 : (multivalue) Component links;
  • field 2 : filter value;

Schema 2 : Component links (allowed in Schema 1)

Requirement : Based on value of a filter (field 2, schema 1), get the correct Schema 1 component. Once this is achieved, loop through the linked components and display the corresponding information on the page (populate view)

There are can be n number of components based on Schema 1.

So, we are able to fetch the component based on Schema 1, but we only get the Id of the linked components. We dont get all the details.

These components are not attached to a page as such and are just published as dynamic components.

The method used for fetching the component was GetEntityModel

2 Answers 2

2

If I got it correctly, you are publishing DCPs based on the desribed Schema. The Components for those DCPs contain Component Links which are to expanded (at least one level).

I’m not sure how the CT you’re using for those DCPs looks? You mentioned “Generate Data Presentation” in a comment. Note that this built-in DXA CT is not really intended for that purpose; it is intended for dynamically expanding linked Components.

I would expect that you’re using your own (Dynamic) Component Template which invokes the “Render Component Content” TBB and has DXA CT metadata, so it renders a full-fledged DXA Entity Model with MVC data.

Furthermore, you should ensure that the “Render Component Content” TBB specifies an appropriate expandLinkDepth parameter value in the invocation of the “Generate DXA R2 Entity Model” TBB.

Note that the “Generate Data Presentation” CT invokes the “Generate R2 Entity Model” TBB directly and also specifies an expandLinkDepth parameter value. This is the depth that Component Links should be (statically) expanded within a Data Presentation (which is normally used for dynamic expansion). Yes, it’s confusing, I know.

Note 2: you can choose between static expansion (CM-side) or dynamic expansion (CD-side in the DXA Model Service) of Component Links by associating your Schema with the”Generate Data Presentation” CT or not. If you use dynamic expansion, the CM-side will indeed only render an Id and it will be a DCP identifier formatted as {ComponentId}-{TemplateId} where {TemplateId} is the identifier of the “Generate Data Presentation” CT.

4
  • Yes, we have our own CT_Dynamic and are publishing using that and we have a depthlevel of 3 for dynamic expansion and static expansion (for other requirements). The components get published but when we use GetEntityModel to get the first component which has other linked components, we are not getting the details of 2nd level components. Our understanding is that since we have dynamic expansion set, our model service should have returned upto 3 levels of components which is not happening.
    – GJin
    Jan 18, 2019 at 13:24
  • There was a defect in the Model Service that Keyword links in a DCP were not dynamically expanded. This has been hotfixed (contact SDL Customer Support). Maybe the problem included Component Link expansion. See github.com/sdl/dxa-model-service/issues/2 Jan 18, 2019 at 14:38
  • We got the hotfix and applied it but it hasnt fixed our issue. For now, we are planning to customize the code to fetch the information.
    – GJin
    Jan 19, 2019 at 13:20
  • Ok, good to hear you can fix the issue yourself. It would be geat if you can submit a Pull Request when you have it fixed; we will ensure that PRs get incorporated in DXA 2.2. Jan 20, 2019 at 10:37
1

Does your published CP contain the data at all, or is the issue just in your built entity model? If the JSON does not contain the data, then it's usually caused by the expandLinkDepth not set to the proper level, see this question/answer. Once this is set properly and the relevant CP is republished, the entity model should also be built properly.

Just a note that don't overdo with this setting as it can cause long publishing times with a huge output. Set it to the minimal level which satisfies your needs.

3
  • We are just publishing components which are not present on a page. The "Generate data presentation" works when the components are present on a page. We have a list component that contains 1 or more linked components. We publish the list component and then fetch it based on certain criterion. When we fetch it, it should get all the linked component information as well, which is not being done.
    – GJin
    Jan 17, 2019 at 16:05
  • This is not clear to me. Please update the Question and elaborate on this. Jan 17, 2019 at 19:15
  • updated the question, pending for peer review
    – GJin
    Jan 18, 2019 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.