Sounds easy enough, but I'm taking the values output in my table from a number of field sets, so admin users can customise the columns that appear in the table.
Here's my functioning page block...
<apex:pageBlock title="{!$Label.Search_Results}">
<apex:pageBlockTable value="{!SearchResults}" var="pictureGallerySearchResult" title="SearchResults">
<apex:column headerValue="Image" styleClass="imageDataCell">
<a target="_blank" href="/servlet/servlet.FileDownload?file={!pictureGallerySearchResult.ActualAttachment.Id}" >
<img class="searchResultImage" style="{!SearchResultsImageStyle}" src="/servlet/servlet.FileDownload?file={!pictureGallerySearchResult.ActualAttachment.Id}" alt="{!pictureGallerySearchResult.ActualAttachment.Name}"/>
</a>
</apex:column>
<apex:column headerValue="Test" value="{!pictureGallerySearchResult.Project[pictureGallerySearchResultField]}"/>
<apex:repeat value="{!$ObjectType.Project__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField">
<apex:column headerValue="{!$ObjectType.Project__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Project[pictureGallerySearchResultField]}"/>
</apex:repeat>
<apex:repeat value="{!$ObjectType.Store__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField">
<apex:column headerValue="{!$ObjectType.Store__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Store[pictureGallerySearchResultField]}"/>
</apex:repeat>
<apex:repeat value="{!$ObjectType.Visit__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField">
<apex:column headerValue="{!$ObjectType.Visit__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Visit[pictureGallerySearchResultField]}"/>
</apex:repeat>
<apex:repeat value="{!$ObjectType.Photo_Attachment__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField">
<apex:column headerValue="{!$ObjectType.Photo_Attachment__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.PhotoAttachment[pictureGallerySearchResultField]}"/>
</apex:repeat>
</apex:pageBlockTable>
</apex:pageBlock>
You can see I've created a 'hard-coded' hyperlink for an image in the first column, but I want to dynamically hyperlink a field, if it is the name field for a custom object.
For example, if the fieldset...
$ObjectType.Project__c.FieldSets.Picture_Gallery_Search_Results
...contains the a field called 'Name', I want to insert a hyperlink that would take you to the salesforce page to view that project.
So firstly I need to be able to determine if the field is a custom object name field and secondly, output a hyper link rather than a label.
If anyone has any ideas, I would be most appreciative.
Thanks for taking the time to read this.