You need to sign in to do that
Don't have an account?
Need to get unique display
Hi all,
i am working on a custom object and i am not able to get name uniquely.can any one help me to get all names unique.
Thanks,
chiru.
Here is my page:
<apex:page controller="Todownload">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!Allattachments}" var="allatt">
<apex:column value="{!allatt.DealName}"/>
<apex:column value="{!allatt.Name}"/>
<apex:column > <apex:outputLink value="/servlet/servlet.FileDownload?file={!allatt.Id}">{!allatt.Name}</apex:outputLink></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
And the controller:
public with sharing class Todownload {
List<Attachment> atlist;
List<Deal__c> Dealfields;
List<WrapperClass> wcList=new List<WrapperClass>();
Set<String> dealidset=new Set<String>();
public List<WrapperClass> getAllattachments() {
Dealfields = [select name, RecordTypeId, Address__c,City__c,State__c,ShortDescription__c,PPM_Funding_Date__c,Fundraising_Goal__c,DealType__c,id from deal__c where ShowInInvestorAdvisorPortals__c=true];
if(Dealfields!=null && Dealfields.size()>0){
for(deal__c deal:Dealfields ){
dealidset.add(deal.id);
}
}
atlist=[Select Name,parentid,id from Attachment where ParentId in :dealidset];
for(Attachment a :atlist ){
WrapperClass w = new WrapperClass();
w.Id = a.Id;
w.Name=a.Name;
for( deal__c d : Dealfields){
if(d.Id==a.parentid){
w.DealName=d.Name;
}
}
wcList.add(w);
}
return wcList;
}
public List<WrapperClass> getWrapperRec(){
System.debug('asdf'+wcList.size());
return wcList;
}
public class WrapperClass{
public string Id{get;set;}
public string Name{get;set;}
public string DealName{get;set;}
}
}
You need to make the Name on the object an autonumber if you want it to be unique, either that or you'll need to write some before insert triggers to check that the name is unique.
thanks Scoobie.