function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Varun AnnadataVarun Annadata 

How to achieve this functionality?

<apex:page standardcontroller="Program_Member_MVN__c" extensions="CaseCounter">
    <apex:pageBlock title="Attachments">
         <apex:pageblockSection >
             <apex:repeat value="{!results}" var="M">  
                <apex:repeat value="{!M.Attachments}" var="temp">
            <!--<apex:pageBlockTable value="{!M.Attachments}" var="temp" >  -->
            <!--<apex:pageBlockTable value="{!temp}" var="a">-->
           <!-- <apex:column value="{!temp}" title="Test"/>-->
                    <apex:outputField value="{!M.CaseNumber}"/>
                    <apex:outputField value="{!temp.Name}"/>
                    <apex:outputField value="{!temp.LastModifiedDate}"/>
                    <apex:outputField value="{!temp.CreatedById}"/>
                  <!--  </apex:pageBlockTable>-->
                 <!-- </apex:pageBlockTable>-->
              </apex:repeat>
             </apex:repeat>
             </apex:pageblockSection>
            </apex:pageBlock>
</apex:page>
Apex class:
public class CaseCounter{
    //public List<AggregateResult> lstagr {get;set;}
    public Program_Member_MVN__c cs;
    public CaseCounter(ApexPages.StandardController controller)
    {
    cs=(Program_Member_MVN__c)controller.getRecord();
    //List<AggregateResult> lstagr =[select sum(CountAttachment__c) tot from case where Program_Member_MVN__c =: cs.id];
    //List<AggregateResult> lstagr = [SELECT id,(select sum(CountAttachment__c)tot from cases__r)FROM Program_Member_MVN__c WHERE id = :cs];
    //List<Program_Member_Stage_MVN__c>Pms = [select id,(select CountAttachment__c from cases__r) from Program_Member_MVN__c where id = :cs];
    //return lstagr;
     //List<Case> lstagr =[select id,(select Name,LastModifiedById,CreatedById from Attachments) from case where Program_Member_MVN__c =:cs.id];
       // for(Case A:lstagr){}
    }
    /*public AggregateResult[] results {
        get {
            return [select sum(CountAttachment__c) tot from case where Program_Member_MVN__c =: cs.id];
        }
    }*/
        
    public List<Case> results{
    get{
    return [select id,CaseNumber,(select Name,LastModifiedById,CreatedById,LastModifiedDate from Attachments) from case where Program_Member_MVN__c =:cs.id];
    }
    }
}
I should display outputlink for  <apex:outputField value="{!temp.Name}"/> but it is not working if i give output link,visualforce is not displaying anything.Why is this happening?

 
Best Answer chosen by Varun Annadata
Alain CabonAlain Cabon
Hi,
 
<apex:outputField value="{!M.CaseNumber}"/>
<apex:outputText  label="Attachment" >
<apex:outputLink value="{!URLFOR($Action.Attachment.Download,temp.Id)}">{!temp.Name}</apex:outputLink>
</apex:outputText>
<apex:outputField value="{!temp.LastModifiedDate}"/>
<apex:outputField value="{!temp.CreatedById}"/>

Regards

All Answers

Raj VakatiRaj Vakati
Hi ,
Use this code.
<apex:outputField value="{!M.CaseNumber}">

<apex:outputLink value="{!URLFOR($Action.Case.View, m.Id)}">
  {!m.CaseNumber}
</apex:outputLink>
 </apex:outputField>


 
Alain CabonAlain Cabon
Hi,
 
<apex:outputField value="{!M.CaseNumber}"/>
<apex:outputText  label="Attachment" >
<apex:outputLink value="{!URLFOR($Action.Attachment.Download,temp.Id)}">{!temp.Name}</apex:outputLink>
</apex:outputText>
<apex:outputField value="{!temp.LastModifiedDate}"/>
<apex:outputField value="{!temp.CreatedById}"/>

Regards
This was selected as the best answer
Varun AnnadataVarun Annadata
Thank you @Alain Cabon and @Rajamohan.Vakati.How can i add line break after all the fields in my visualforce page.User-added image

how can i add total row break after createdby so different records look distinctive?