Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Eval in transformation or page template View modes: 
User avatar
Member
Member
pawel.forys-wp - 1/27/2012 10:33:39 AM
   
Eval in transformation or page template
Hi,
I am very beginner in Kentico and its highly possible, that I am doing here something obviously , so I am asking for little patience.

The problem of mine is that Eval method used in ASCX transformation is not retrieving any data. Can someone tell me what am I doing wrong? I created an Article and assgined the Repeater (I also tried with the Univeral Viewer) to the zone on the page. In the Repeater I am choosing current Document by direct path or by ".". And choosing the "Default" transformation. Whole html content included in the transformation is displayed correctly. Instead of value from the form. (It is filled with data of course). I was able though to retrieve the GetDocumentUrl() from inside of the transformation.

The trasformation is very simple:

<h1><%# GetDocumentUrl() %></h1>
<h1><%# Eval("ArticleName") %></h1>
test
<%# Eval("ArticleText") %>


I am learning Kentico and trying to understand its possibilities, and this seems to be like the very basic feature. Hovewer it is not working...


User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 1/27/2012 10:52:23 AM
   
RE:Eval in transformation or page template
Make sure that you have chosen the correct document type in the Content Filter section of your repeater's web part properties. I may be wrong about this, but I think that if you don't choose the document type, then it doesn't load the custom fields for that document.

You can test my theory by adding <%# Eval("DocumentName")%> to your template before you add your document type to the content filter and see if it returns anything.

If so, it means that when you don't specify document types then it only loads the fields that are common for all document types instead of the additional fields for each document type specified.

User avatar
Member
Member
pawel.forys-wp - 1/27/2012 11:25:05 AM
   
RE:Eval in transformation or page template
Yes exactly! That was the case.

Hovewer IMO this is not very intuitive if you have to specify list of all needed document types when the fieldset is called "content filter"... Thats why I left it blank, in order to NOT filter antyhing...

Thank you very much!

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 1/27/2012 12:04:16 PM
   
RE:Eval in transformation or page template
Hi,

But from the performance point of view it is better to specify what you want to pull out of the database and not to pull everything. So, you can try to play also with the "columns" property - using this you will specify only columns from given tables you want to save the amount of data. To get more details, please check this document management documentation. IT will tell you what and where is saved. I think it is a good thing to start with so you can consider the performance things from your very begining with Kentico CMS :-)

Best regards,
Juraj Ondrus

User avatar
Member
Member
pawel.forys-wp - 1/27/2012 12:16:31 PM
   
RE:Eval in transformation or page template
Yes I completely agree and its very reasonable that defaulty when user wont choose any specifc document type, the engine shouldn't be overloaded by retrieveing all possible data. I am only arguing with the naming convenction :). I am just saying in case of usability, that filtering is not exactly equal to listing all needed conditions. Once learned you know how to use it, its just may make some additional confusion, when you use it for the first time.
So no offence, its good as it is, as long as it works :) Thanks for the reply!

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 1/27/2012 3:50:14 PM
   
RE:Eval in transformation or page template
Hi,
no problem at all!

The problem is, that every vendor names the properties differently. I agree that learning the semantic meaning is not easy (like learning new language).

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 1/27/2012 1:43:21 PM
   
RE:Eval in transformation or page template
To add to what Juraj has said, choosing the document types you want also gives you a way to make sure that the transformation you choose will work when it contains Evals for fields that may only exist in the content type you wish to display. In other words, you should make sure that your transformations match your document types.

On that note, if you select more than one document type, you would need to add some fancy code to make it change the transformation based upon the content type if you wish to use properties that are not common across all of the document types that you have selected. You would basically need to have a nested repeater and a function to evaluate the NodeClassName property of the document and translate that into a transformation name to feed the nested repeater. This may be getting ahead of you as you are new to Kentico, but it is possible that you will run across an scenario where you would like to do this in the future. There are other ways to accomplish this goal, but you can cross that bridge when you come to it.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 1/27/2012 3:46:16 PM
   
RE:Eval in transformation or page template
I am missing a like/+1 button here :-)

Thanks Jiveabillion!

@Pawel - if you will have any other difficulties, do not hesitate to post them here, we will be happy to help you!

Have a nice weekend guys!

Juraj Ondrus