You need to sign in to do that
Don't have an account?
nikita dhamal
passing distinct value of records to vf page
i have a cloumn KOLTitleRole in my visualforce page in which i get duplicate values. i have modified the code but still getting duplicates... where am i going wrong?please help...
i have attached my code below
vf page:
<apex:pageBlockTable value="{!KOLTitleRole}" var="v" style="width:100px;">
<apex:column headerValue="KOL - Title/ Role">
<apex:outputLink value="/{!v.id}" target="_blank" style="text-decoration:none;">
<apex:facet name="Header">KOL-Title/ Role</apex:facet>
<div style="color:white; background-color:{!If(v.Status__c =='Not Needed'||v.name==null,'color:#797d7f','#736F6E')};">
{!v.KOL_Title__c} </div></apex:outputLink>
</apex:column>
</apex:pageBlockTable>
controller:
public List<Product_EntryStatus__c>getKOLTitleRole()
{
List<Product_EntryStatus__c>dosiersumbitlist;
// dosiersumbitlist= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Country__c =: prod.Country__c and Product__c=: prod.Product__c and KOL_Title__c!=null];
List<Product_EntryStatus__c> lstAccount = new List<Product_EntryStatus__c>();
Set<String> setKolName = new Set<String>();
lstAccount = [select Name,KOL_Title__c from Product_EntryStatus__c where Country__c =: prod.Country__c and Product__c=:prod.Product__c and KOL_Title__c!=null]
for (Integer i = 0; i< lstAccount.size(); i++)
{
setkolName.add(lstAccount[i].KOL_Title__c); // contains distict values
String qs='SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where' +Product_EntryStatus__c.KOL_Title__c +'IN :'+setkolName;
System.debug('Query string is: '+ qs);
System.debug('****************************************'+setkolName);
dosiersumbitlist= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where KOL_Title__c =:setkolName];
}
return dosiersumbitlist;
}
i have attached my code below
vf page:
<apex:pageBlockTable value="{!KOLTitleRole}" var="v" style="width:100px;">
<apex:column headerValue="KOL - Title/ Role">
<apex:outputLink value="/{!v.id}" target="_blank" style="text-decoration:none;">
<apex:facet name="Header">KOL-Title/ Role</apex:facet>
<div style="color:white; background-color:{!If(v.Status__c =='Not Needed'||v.name==null,'color:#797d7f','#736F6E')};">
{!v.KOL_Title__c} </div></apex:outputLink>
</apex:column>
</apex:pageBlockTable>
controller:
public List<Product_EntryStatus__c>getKOLTitleRole()
{
List<Product_EntryStatus__c>dosiersumbitlist;
// dosiersumbitlist= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Country__c =: prod.Country__c and Product__c=: prod.Product__c and KOL_Title__c!=null];
List<Product_EntryStatus__c> lstAccount = new List<Product_EntryStatus__c>();
Set<String> setKolName = new Set<String>();
lstAccount = [select Name,KOL_Title__c from Product_EntryStatus__c where Country__c =: prod.Country__c and Product__c=:prod.Product__c and KOL_Title__c!=null]
for (Integer i = 0; i< lstAccount.size(); i++)
{
setkolName.add(lstAccount[i].KOL_Title__c); // contains distict values
String qs='SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where' +Product_EntryStatus__c.KOL_Title__c +'IN :'+setkolName;
System.debug('Query string is: '+ qs);
System.debug('****************************************'+setkolName);
dosiersumbitlist= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where KOL_Title__c =:setkolName];
}
return dosiersumbitlist;
}
I have done bit modification on your code. Please refer
Please let me know still if you are facing an issue.
Thanks,
Prem Anandh