in a custom ListDefinition I used a calculated field to format a Text into an URL. I'm developping in VisualStudio2010 for SP2010.
Here is my ListDefinition:
<Fields>
<Field Name="DocumentLink" StaticName="DocumentLink" DisplayName="Dokumentenlink" Type="Text"
ID="8E434824-3230-493D-86B0-A60BABC56672"/>
<Field Name="LinkType" StaticName="LinkType" DisplayName="Linktyp" Type="Choice" Format="RadioButtons"
ID="D6A6880E-DF32-4A15-B5CC-1ABFA88EF2F4" >
<CHOICES>
<CHOICE>HTTP</CHOICE>
<CHOICE>Datei/Ordner</CHOICE>
</CHOICES>
</Field>
<Field Name="DocumentPath" StaticName="DocumentPath" DisplayName="DocumentPath" Type="Calculated"
LCID="1031" ResultType="Text"
ID="3957EA2D-5E88-477D-B801-27A51B5599C2" >
<Formula>=IF(LinkType="Datei/Ordner", CONCATENATE("file:///", DocumentLink), DocumentLink)</Formula>
<FieldRefs>
<FieldRef Name="LinkType" />
<FieldRef Name="DocumentLink" />
</FieldRefs>
</Field>
</Fields>
in my View the Field is displayed as Text, but in the DisplayForm it's (like i expect it) displayed as hyperlink.
My ViewFields are not complicated, so I would guess this isn't the failure
<ViewFields>
<FieldRef Name="LinkTitle"></FieldRef>
<FieldRef Name="DocumentPath" Format="Hyperlink" CreateURL="TRUE" TextOnly="FALSE" >
</FieldRef>
<FieldRef Name="Describtion" ></FieldRef>
</ViewFields>
Tried solutions: -Adding a Computed Field with DisplayPattern. -Formula which calculates the FieldValue in HTML-tags (value) Alternative formula:
<Formula>
=IF(LinkType="Datei/Ordner",
CONCATENATE("<DIV><A href='file:///", DocumentLink, "' >", DocumentLink, "</A></DIV>"),
CONCATENATE("<DIV><A href='", DocumentLink, "' >", DocumentLink, "</A></DIV>"))
</Formula>
Thanks for your help in advance.