Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Guid to url in transformation View modes: 
User avatar
Member
Member
lwhittemore-emh - 1/5/2012 4:31:34 PM
   
Guid to url in transformation
is there a way to convert a documents guid to it's url in a transformation?

Here is what I have but I am getting the guid in the URL instead of the url.

<%# IfEmpty (Eval("Url"),"", "<a href=\"" + Eval("Url") + "\">")%>
<%# GetImage("Image") %>
<%# IfEmpty (Eval("Url"),"", "</a>")%>


Thanks in advance!

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/5/2012 11:04:22 PM
   
RE:Guid to url in transformation
Hello,

If you want to display an attachment and you have the attachments GUID, you can use this approach:

www.domain.com/getattachment/guid/filename.ext

The transformation should look the following way:

<a href="www.domain.com/getattachment/<%# Eval("customField")%>/fileName.ext" >
<%# Eval("DocumentName") %>
</a>

If that's not the case, please describe your setup in more details. What do you want to display the link to? Is it a file? If yes, where is it stored? Is it a document in the content tree (not an attachment)?

Best regards,
Boris Pocatko

User avatar
Member
Member
lwhittemore-emh - 1/6/2012 1:58:38 PM
   
RE:Guid to url in transformation
In my document type I have a field for a url called Url.
Under Field Appearance I have the "Form Control Type set to "Selector" and the form control set to "Document Selector"

When I run eval("url") in my transformation I get the documents guid.

However I found that if I change the form control to "Url Selector" it does what I want, with the expectation that if the document I am linking to's url change it doesn't automatically update.

Basically what I wnat to know is there a built in function that converts a documents guid to it's url.

so putting something like SomeMagicFuction("Url") will turn out the address to that document not the Guid that is stored in the field.


Hope this made sense.

Thanks

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 1/8/2012 1:09:54 AM
   
RE:Guid to url in transformation
Hi,

Could you please check this KB article and/or also the articles mentioned as "see also"? They are of an older date but the approach is still the same how to get the link (or other data) to a file when having its GUID available.

Best regards,
Juraj Ondrus