Skip to content

Instantly share code, notes, and snippets.

@brianmfear
Created April 7, 2016 17:22
Show Gist options
  • Save brianmfear/a144b140540f146e014680ed5ab02691 to your computer and use it in GitHub Desktop.
Save brianmfear/a144b140540f146e014680ed5ab02691 to your computer and use it in GitHub Desktop.
Documents and Their Sizes
public class Documents {
public Document[] getDocuments() {
return [SELECT Name, BodyLength FROM Document];
}
}
<apex:page controller="Documents">
<apex:dataTable value="{!documents}" var="doc">
<apex:column headerValue="File Name" value="{!doc.Name}" />
<apex:column headerValue="File Size (KB)" value="{!floor(doc.BodyLength / 1024)} KB" />
</apex:dataTable>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment