You need to sign in to do that
Don't have an account?
Jeremy Deseez
Same method for 4 different PageBlockTable
Hello SFDC,
I have a method who return the Users with their associated Quotas.
It show the result in a PageBlockTable.
But I want to put 3 PageBlockTables near the first one, which show the next quarters.
It's like :
Q1 Q2 Q3 Q4
Tom Jones Tom Jones Tom Jones Tom Jones
John Doe John Doe John Doe John Doe
With my code, i got the first quarter, but I don't know how to make the next 3 quarters.
Controller :
Visualforce Page :
Kind Regards
I have a method who return the Users with their associated Quotas.
It show the result in a PageBlockTable.
But I want to put 3 PageBlockTables near the first one, which show the next quarters.
It's like :
Q1 Q2 Q3 Q4
Tom Jones Tom Jones Tom Jones Tom Jones
John Doe John Doe John Doe John Doe
With my code, i got the first quarter, but I don't know how to make the next 3 quarters.
Controller :
public void searchQuotas(){ List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>(); resultsquotas = [SELECT Id,QuotaAmount,QuotaOwnerId, StartDate FROM ForecastingQuota WHERE StartDate >=:namequarter AND StartDate <=:namequarter2 ORDER BY QuotaOwnerId ASC]; List<User> resultsusers = new List<User>(); if(idofuserrole != null){ resultsusers = [SELECT Id FROM User WHERE IsActive =:usertype AND ForecastEnabled = TRUE AND UserRoleId =:idofuserrole]; } else { resultsusers = [SELECT Id FROM User WHERE IsActive =:usertype AND ForecastEnabled = TRUE]; } Map<Id, ForecastingQuota> fqsByOwnerId = new Map<Id, ForecastingQuota>(); for (ForecastingQuota fq : resultsquotas) { fqsByOwnerId.put(fq.QuotaOwnerId, fq); } // new map of quotas keyed by all user ids Map<Id, ForecastingQuota> allUserFqsByOwnerId = new Map<Id, ForecastingQuota>(); for (User u : resultsusers) { allUserFqsByOwnerId.put(u.id, fqsByOwnerId.containsKey(u.id) ? fqsByOwnerId.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null)); } allthequotas = new List<ForecastingQuota>(); allthequotas = allUserFqsByOwnerId.values(); allthequotas.sort(); }
Visualforce Page :
<apex:pageBlockSection columns="4" id="allquotas"> <apex:pageBlockTable value="{!allthequotas}" var="key"> <apex:column headerValue="Check"> <apex:inputCheckbox id="checkbox" styleClass="checkbox1"/> </apex:column> <apex:column headerValue="Name"> <apex:outputField value="{!key.QuotaOwnerId}"/> </apex:column> <apex:column headerValue="Quota"> <apex:inputField value="{!key.QuotaAmount}" id="test" styleClass="childCheck" required="false"/> </apex:column> <apex:column headerValue="Quota"> <apex:outputField value="{!key.StartDate}"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockTable value="{!allthequotas}" var="key2"> <apex:column headerValue="Check"> <apex:inputCheckbox id="checkbox" styleClass="checkbox2"/> </apex:column> <apex:column headerValue="Name"> <apex:outputField value="{!key2.QuotaOwnerId}"/> </apex:column> <apex:column headerValue="Quota"> <apex:inputField value="{!key2.QuotaAmount}" id="test2" required="false"/> </apex:column> <apex:column headerValue="Quota"> <apex:outputField value="{!key.StartDate}"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockTable value="{!allthequotas}" var="key3"> <apex:column headerValue="Check"> <apex:inputCheckbox id="checkbox" styleClass="checkbox3"/> </apex:column> <apex:column headerValue="Name"> <apex:outputField value="{!key3.QuotaOwnerId}"/> </apex:column> <apex:column headerValue="Quota"> <apex:inputField value="{!key3.QuotaAmount}" required="false"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockTable value="{!allthequotas}" var="key4"> <apex:column headerValue="Check"> <apex:inputCheckbox id="checkbox" styleClass="checkbox4"/> </apex:column> <apex:column headerValue="Name"> <apex:outputField value="{!key4.QuotaOwnerId}"/> </apex:column> <apex:column headerValue="Quota"> <apex:inputField value="{!key4.QuotaAmount}" required="false"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock>
Kind Regards