Getting property names when writing Transformations. Is it a guessing game?

Kyle G asked on November 5, 2014 16:15

I'm in the process of writing a transformation to display the top X number of recent articles on my site. I have many different items/pages of different (custom) Page Types.

If I go to the General/Properties tab of a page, I see there's a Type field but when trying to write the Eval() statement, I can't figure out the exact name of the property.

I've tried:

<%# Eval("PageType") %>
<%# Eval("Type") %>
<%# Eval("DocumentType") %>

Is there a list of the common properties somewhere, with their actual values used for Eval()? I'm using Kentico 8.

Thanks a million!

Correct Answer

Jim Spillane answered on November 6, 2014 04:47

For the Type try

<%# Eval("ClassDisplayName") %>

If you can't run the query Brenden suggested, you can navigate in the Admin to Development | Database objects. There you can edit the view and Preview the fields and data for the page type selected.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Ivana Liptakova answered on November 5, 2014 19:08

Hi,

is there a reason why you are using aspx transformation?

In case you would like to display only document, custom page type, sku or node data you can create a text/xml transformation (select Transformation type: Text/xml). Then you can type {% %} and in the body of the macro you can use CTRL + SPACE to display available fields and macro methods).

Example: {% DocumentName %}

In XML transformation you do not need to use Eval.

Best regards,

Ivana Liptakova

0 votesVote for this answer Mark as a Correct answer

Kyle G answered on November 5, 2014 19:32

Hi,

I'm just using the default layout (aspx I guesS). It's just what we've done in the past. I can get everything else working the way I want it to, except for the DocumentType.

<%# Eval("DocumentName") %>
Created: <%#FormatDateTime( Eval("DocumentCreatedWhen"), "MMMM dd, yyyy")%>
Document Type: <%# Eval("DocumentType") %>


<%# Eval("Content") %>
0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 6, 2014 03:14

There is not a list of them.

If you have access to run a query run this once:

SELECT TOP 100 *
FROM VIEW_Content_MenuItem_Joined

This will give you an example of the fields that are available when a page type is displayed. In this case, this is the Page (Menu item) page type. You will see the last few columns are actually specific to the Menu Item page type while all the other fields are pretty foreign to you. Those other fields are what are used to create the tree view and the ending "page" to be displayed. You have access to all those fields in the transformation.

0 votesVote for this answer Mark as a Correct answer

Kyle G answered on November 6, 2014 16:27

Thanks Jim! ClassDisplayName worked for me.

Brenden, thanks as well. In the future I'll use that query.

0 votesVote for this answer Mark as a Correct answer

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