get children fields (DocumnetName,DescriptionField)

web dev asked on January 14, 2019 19:50

hello kentico i try to apply transformation to get the fields of the children i want to display descriptionField here is my transformation

{%foreach (x in Documents[NodeAliasPath].Children){ %}

      {%x.DescriptionField%} 

    {%}#%}

thanks

Correct Answer

Dragoljub Ilic answered on January 15, 2019 11:31

Hi,

Did you tried Brenden's example without using brackets at the end (without '()')? Should try something like this:

{% foreach (x in Documents[NodeAliasPath].Children.WithAllData){ %}
    {%x.GetValue("ColumnName")%} 
{% } |(identity)GlobalAdministrator%}

Which version of Kentico you are using? There was an issue with Documents macro in Kentico 10, which is fixed in hotfix 10.0.4 I think.

Best regards, Dragoljub

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on January 14, 2019 20:20 (last edited on December 10, 2019 02:31)

If these are custom fields you've added to a page type, you'll need to add another piece to this (not tested):

{% foreach (x in Documents[NodeAliasPath].Children.WithAllData()){ %}
    {%x.GetValue("ColumnName")%} 
{% } |(identity)GlobalAdministrator%}

Test/check your macros using the Macro Console under System -> Macros -> Console

0 votesVote for this answer Mark as a Correct answer

web dev answered on January 14, 2019 22:21 (last edited on January 14, 2019 22:34)

hello Brenden Kehren should i check something in macro becuase its not working

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 15, 2019 02:49

Yes, as I mentioned test/check your macros using the Macro Console under System -> Macros -> Console. You'll have to change the NodeAliasPath to an actual string value like:

Documents["/Some/Path/In/Your/Tree"].Children.WithAllData()

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.