Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Document type URL links on or off View modes: 
User avatar
Member
Member
Jon White - 12/10/2013 11:39:34 AM
   
Document type URL links on or off
Hi there,

I have a staff list which displays document types using a repeater .

This displays a 'preview'/snippet of them using a shorter transformation i.e. photo, name, job title and email.

The idea is you can click on some people and see a more detailed page with biography and other stuff..

Now, the problem is that not all of the staff have a biography, am i able to create a way to stop creating a link when there is no 'full biography'?

In my preview transformation the code sample is the following:

<h2><a href="<%# GetDocumentUrl() %>"><%# Eval("Name") %></a></h2>

So this means every time a user is created it creates a link which will show you a full bio.

I didn't know if there could be a checkbox in the form of the document type that says 'yes has bio', 'no they don't' then the transformation will create the link based on that, if so how would i do this, or is there a simpler more obvious way?

Thanks in advance

Jon


User avatar
Member
Member
matt-awg - 12/10/2013 12:03:52 PM
   
RE:Document type URL links on or off
Is the full biography just a single field? If so, assumming it is called "FullBioField", something like this would only show the link if that field is not empty:

<h2><%# IfEmpty(Eval("FullBioField"), "", "<a href=\"" + GetDocumentUrl() + "\">") %>
<%# Eval("Name") %>
<%# IfEmpty(Eval("FullBioField"), "", "</a>") %>
</h2>


I did not test it but the idea should work. If there are multiple fields that are required to make a "full bio", then you could nest "IfEmpty" calls.

User avatar
Member
Member
kentico_sandroj - 12/10/2013 5:04:03 PM
   
RE:Document type URL links on or off
Hi Jon,

As Matt mentioned, you would use a transformation method to check the field value. You could add the "yes has bio" option to the document type but you would still use a transformation method to check the value. Instead of checking for blank, you would be comparing the value of that field to another value using a method such as IfCompare. You could also create a custom function but I believe one of the default methods would be fine to use.

Please let me know if you have any questions.

Best Regards,
Sandro