You need to sign in to do that
Don't have an account?

Mapping values into one single column and where there is null value it should display a blank field
I have two objects Contacts and Product.
Every contact has a product associated with it and every product has a product status i.e(Awarenes,Credibility,Connection,Advocating).
I want to display the values in one column mapping the contacts(KOL Name) with each product status.
The cell color will also vary according to the status. How can i implement this.
Please help me on this .
Order KOL - Title/ Role KOLName Credibility Awareness Connection Advocating
1.00 MNCP Manager Keziah Malm P-023 P-023 P-004 P-006
APEX PAGE
--------------------------------------------------------------------------
<apex:page standardController="Product_EntryStatus__c" extensions="tt" > <apex:pageBlock > <apex:pageBlockSection > <apex:pageBlockTable value="{!wrapper}" var="wrap"> <apex:facet name="Header">Advocating</apex:facet> <apex:column headerValue="Order" value="{!wrap.ordRec.Order__c}"/> <apex:column headerValue="KOL Title" value="{!wrap.kolRec.KOL_Title__c}"/> <apex:column headerValue="KOL Name" value="{!wrap.conRec.Key_Opinion_Leader__r.Name}"/> //<apex:column headerValue="Credibility" value="{!wrap.credRec.Name}"/> <apex:column headerValue="Awareness" value="{!wrap.accRec.Name}"/> <apex:column headerValue="Connection" value="{!wrap.connRec.Name}"/> <apex:column headerValue="Advocating" value="{!wrap.advoRec.Name}"/> <!-- you can add related fields here --> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:page>
APEX CLASS
------------------------------------------------------------------------
public class tt
{
public Product_EntryStatus__c prod;
public List<Product_EntryStatus__c> accLst {get; set;}
public List<Product_EntryStatus__c> conLst {get; set;}
public List<Product_EntryStatus__c> kolLst {get; set;}
public List<Product_EntryStatus__c> ordLst {get; set;}
public List<Product_EntryStatus__c> credlst{get;set;}
public List<Product_EntryStatus__c> connlst{get;set;}
public List<Product_EntryStatus__c> convlst{get;set;}
public List<Product_EntryStatus__c> advolst{get;set;}
public List<MyWrapper> wrapper {get; set;}
public List<Product_EntryStatus__c> getAdvocating()
{
List<Product_EntryStatus__c> Advocating = [SELECT Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Advocating' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Order__c,Key_Opinion_Leader__r.Name DESC NULLS LAST];
List<String> setName = new List<String>();
for (Product_EntryStatus__c pe:Advocating) {
setName.add(pe.Key_Opinion_Leader__r.Name);
}
system.debug('**********setName***********'+setName);
Advocating= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Key_Opinion_Leader__r.Name in:setName and Process_Step__c ='Advocating' and Country__c =: prod.Country__c and Product__c=: prod.Product__c ORDER BY Order__c,Key_Opinion_Leader__r.Name DESC NULLS LAST];
return Advocating;
}
public List<Product_EntryStatus__c> getCredibility()
{
List<Product_EntryStatus__c>credlst= [SELECT id,Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Credibility' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Order__c ASC NULLS LAST];
List<String> setName = new List<String>();
for (Product_EntryStatus__c pe:credlst) {
setName.add(pe.Key_Opinion_Leader__r.Name);
}
system.debug('**********setName***********'+setName);
credlst = [SELECT id,Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Key_Opinion_Leader__r.Name in:setName and Process_Step__c ='Credibility' and Country__c =: prod.Country__c and Product__c=: prod.Product__c ORDER BY Order__c ASC];
return credlst ;
}
public List<Product_EntryStatus__c> getConnection()
{
List<Product_EntryStatus__c>Connection= [SELECT Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Connection' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Order__c,Key_Opinion_Leader__r.Name ASC NULLS LAST];
List<String> setName = new List<String>();
for (Product_EntryStatus__c pe:Connection) {
setName.add(pe.Key_Opinion_Leader__r.Name);
}
system.debug('**********setName***********'+setName);
Connection= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Key_Opinion_Leader__r.Name in:setName and Process_Step__c ='Connection' and Country__c =: prod.Country__c and Product__c=: prod.Product__c ORDER BY Order__c ASC NULLS LAST];
return Connection;
}
public List<Product_EntryStatus__c> getConvinced()
{
List<Product_EntryStatus__c> Convinced = [SELECT Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Convinced' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Order__c,Key_Opinion_Leader__r.Name ASC NULLS LAST];
List<String> setName = new List<String>();
for (Product_EntryStatus__c pe:Convinced) {
setName.add(pe.Key_Opinion_Leader__r.Name);
}
system.debug('**********setName***********'+setName);
Convinced= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Key_Opinion_Leader__r.Name in:setName and Process_Step__c ='Convinced' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Key_Opinion_Leader__r.Name desc];
system.debug('**********setConvinced***********'+Convinced);
return Convinced;
}
public tt(ApexPages.StandardController controller)
{
prod= new Product_EntryStatus__c();
this.prod= (Product_EntryStatus__c )controller.getRecord();
accLst = [select id,name,Status__c from Product_EntryStatus__c ] ;
conLst = [select id,Key_Opinion_Leader__r.Name,Status__c from Product_EntryStatus__c ] ;
kolLst = [select id,KOL_Title__c from Product_EntryStatus__c ] ;
ordLst = [select id,Order__c from Product_EntryStatus__c ] ;
credlst = [SELECT id,Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Credibility' ];
connLst = [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Process_Step__c ='Connection' ];
convLst = [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Process_Step__c ='Convinced' ];
advoLst = [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Process_Step__c ='Advocating' ];
system.debug('**********credlst ***********'+credlst);
wrapper = new List<MyWrapper>() ;
for(Integer i=0 ;i<3;i++)
wrapper.add(new MyWrapper(accLst[i],conLst[i],kolLst[i],ordLst[i],credlst[i], connLst[i],convLst[i],advoLst[i])) ;
}
public class MyWrapper
{
public Product_EntryStatus__c accRec {get; set;}
public Product_EntryStatus__c conRec {get; set;}
public Product_EntryStatus__c kolRec {get; set;}
public Product_EntryStatus__c ordRec {get; set;}
public Product_EntryStatus__c credRec {get; set;}
public Product_EntryStatus__c connRec {get; set;}
public Product_EntryStatus__c convRec {get; set;}
public Product_EntryStatus__c advoRec {get; set;}
public MyWrapper(Product_EntryStatus__c acc ,Product_EntryStatus__c con,Product_EntryStatus__c kol,Product_EntryStatus__c ord,Product_EntryStatus__c cred,Product_EntryStatus__c conn,Product_EntryStatus__c conv,Product_EntryStatus__c advo)
{
accRec = acc ;
conRec = con ;
kolRec = kol ;
ordRec = ord;
credRec = cred;
connRec = conn;
convRec = conv;
advoRec = advo;
}
}
}
Every contact has a product associated with it and every product has a product status i.e(Awarenes,Credibility,Connection,Advocating).
I want to display the values in one column mapping the contacts(KOL Name) with each product status.
The cell color will also vary according to the status. How can i implement this.
Please help me on this .
Order KOL - Title/ Role KOLName Credibility Awareness Connection Advocating
1.00 MNCP Manager Keziah Malm P-023 P-023 P-004 P-006
APEX PAGE
--------------------------------------------------------------------------
<apex:page standardController="Product_EntryStatus__c" extensions="tt" > <apex:pageBlock > <apex:pageBlockSection > <apex:pageBlockTable value="{!wrapper}" var="wrap"> <apex:facet name="Header">Advocating</apex:facet> <apex:column headerValue="Order" value="{!wrap.ordRec.Order__c}"/> <apex:column headerValue="KOL Title" value="{!wrap.kolRec.KOL_Title__c}"/> <apex:column headerValue="KOL Name" value="{!wrap.conRec.Key_Opinion_Leader__r.Name}"/> //<apex:column headerValue="Credibility" value="{!wrap.credRec.Name}"/> <apex:column headerValue="Awareness" value="{!wrap.accRec.Name}"/> <apex:column headerValue="Connection" value="{!wrap.connRec.Name}"/> <apex:column headerValue="Advocating" value="{!wrap.advoRec.Name}"/> <!-- you can add related fields here --> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:page>
APEX CLASS
------------------------------------------------------------------------
public class tt
{
public Product_EntryStatus__c prod;
public List<Product_EntryStatus__c> accLst {get; set;}
public List<Product_EntryStatus__c> conLst {get; set;}
public List<Product_EntryStatus__c> kolLst {get; set;}
public List<Product_EntryStatus__c> ordLst {get; set;}
public List<Product_EntryStatus__c> credlst{get;set;}
public List<Product_EntryStatus__c> connlst{get;set;}
public List<Product_EntryStatus__c> convlst{get;set;}
public List<Product_EntryStatus__c> advolst{get;set;}
public List<MyWrapper> wrapper {get; set;}
public List<Product_EntryStatus__c> getAdvocating()
{
List<Product_EntryStatus__c> Advocating = [SELECT Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Advocating' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Order__c,Key_Opinion_Leader__r.Name DESC NULLS LAST];
List<String> setName = new List<String>();
for (Product_EntryStatus__c pe:Advocating) {
setName.add(pe.Key_Opinion_Leader__r.Name);
}
system.debug('**********setName***********'+setName);
Advocating= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Key_Opinion_Leader__r.Name in:setName and Process_Step__c ='Advocating' and Country__c =: prod.Country__c and Product__c=: prod.Product__c ORDER BY Order__c,Key_Opinion_Leader__r.Name DESC NULLS LAST];
return Advocating;
}
public List<Product_EntryStatus__c> getCredibility()
{
List<Product_EntryStatus__c>credlst= [SELECT id,Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Credibility' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Order__c ASC NULLS LAST];
List<String> setName = new List<String>();
for (Product_EntryStatus__c pe:credlst) {
setName.add(pe.Key_Opinion_Leader__r.Name);
}
system.debug('**********setName***********'+setName);
credlst = [SELECT id,Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Key_Opinion_Leader__r.Name in:setName and Process_Step__c ='Credibility' and Country__c =: prod.Country__c and Product__c=: prod.Product__c ORDER BY Order__c ASC];
return credlst ;
}
public List<Product_EntryStatus__c> getConnection()
{
List<Product_EntryStatus__c>Connection= [SELECT Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Connection' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Order__c,Key_Opinion_Leader__r.Name ASC NULLS LAST];
List<String> setName = new List<String>();
for (Product_EntryStatus__c pe:Connection) {
setName.add(pe.Key_Opinion_Leader__r.Name);
}
system.debug('**********setName***********'+setName);
Connection= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Key_Opinion_Leader__r.Name in:setName and Process_Step__c ='Connection' and Country__c =: prod.Country__c and Product__c=: prod.Product__c ORDER BY Order__c ASC NULLS LAST];
return Connection;
}
public List<Product_EntryStatus__c> getConvinced()
{
List<Product_EntryStatus__c> Convinced = [SELECT Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Convinced' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Order__c,Key_Opinion_Leader__r.Name ASC NULLS LAST];
List<String> setName = new List<String>();
for (Product_EntryStatus__c pe:Convinced) {
setName.add(pe.Key_Opinion_Leader__r.Name);
}
system.debug('**********setName***********'+setName);
Convinced= [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Key_Opinion_Leader__r.Name in:setName and Process_Step__c ='Convinced' and Country__c =: prod.Country__c and Product__c=: prod.Product__c order by Key_Opinion_Leader__r.Name desc];
system.debug('**********setConvinced***********'+Convinced);
return Convinced;
}
public tt(ApexPages.StandardController controller)
{
prod= new Product_EntryStatus__c();
this.prod= (Product_EntryStatus__c )controller.getRecord();
accLst = [select id,name,Status__c from Product_EntryStatus__c ] ;
conLst = [select id,Key_Opinion_Leader__r.Name,Status__c from Product_EntryStatus__c ] ;
kolLst = [select id,KOL_Title__c from Product_EntryStatus__c ] ;
ordLst = [select id,Order__c from Product_EntryStatus__c ] ;
credlst = [SELECT id,Name,Status__c,Country__c,Product__c,Key_Opinion_Leader__r.Name FROM Product_EntryStatus__c where Process_Step__c ='Credibility' ];
connLst = [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Process_Step__c ='Connection' ];
convLst = [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Process_Step__c ='Convinced' ];
advoLst = [SELECT Name,Status__c,Country__c,Product__c,KOL_Title__c,Key_Opinion_Leader__c FROM Product_EntryStatus__c where Process_Step__c ='Advocating' ];
system.debug('**********credlst ***********'+credlst);
wrapper = new List<MyWrapper>() ;
for(Integer i=0 ;i<3;i++)
wrapper.add(new MyWrapper(accLst[i],conLst[i],kolLst[i],ordLst[i],credlst[i], connLst[i],convLst[i],advoLst[i])) ;
}
public class MyWrapper
{
public Product_EntryStatus__c accRec {get; set;}
public Product_EntryStatus__c conRec {get; set;}
public Product_EntryStatus__c kolRec {get; set;}
public Product_EntryStatus__c ordRec {get; set;}
public Product_EntryStatus__c credRec {get; set;}
public Product_EntryStatus__c connRec {get; set;}
public Product_EntryStatus__c convRec {get; set;}
public Product_EntryStatus__c advoRec {get; set;}
public MyWrapper(Product_EntryStatus__c acc ,Product_EntryStatus__c con,Product_EntryStatus__c kol,Product_EntryStatus__c ord,Product_EntryStatus__c cred,Product_EntryStatus__c conn,Product_EntryStatus__c conv,Product_EntryStatus__c advo)
{
accRec = acc ;
conRec = con ;
kolRec = kol ;
ordRec = ord;
credRec = cred;
connRec = conn;
convRec = conv;
advoRec = advo;
}
}
}
Is 'product status' a pickList field?
Yes 'Product Status' is a picklist field.
And the mapping of the 'Product Status' should be with an 'Product No' field.