function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ramya1ramya1 

Holidays Count

Hi,

 

Am trying to display list of leave applications which counts number of days from FromDate to ToDate...I have a Formula field named  NoOfDays  which counts the number of leave days excluding saturdays and sundays...

 

there were a list of holidays..now i want to exclude the  holiday  from NoOfDays  if it falls between from and to dates....

i used

 

d = userinput.From_Includes_this_day__c;
d1 = userinput.To_Includes_this_day_also__c;

 

leave = [select id,name,Manager_Email_Id__c,From_Includes_this_day__c,To_Includes_this_day_also__c,Reason__c,CreatedDate,Approved__c,
Numberofdays__c,CreatedById from Leave_Applications__c where CreatedById=:usr.id order by From_Includes_this_day__c];

 

 holidaysweek = [select id,name,ActivityDate from Holiday where ActivityDate>=:d AND ActivityDate<=:d1 ];

 holidayscount = holidaysweek.size();

 

ON PAGE I USED

 

<apex:column headerValue="Total No of days">
{!floor(a.Numberofdays__c -holidayscount )}
</apex:column>

 

when am trying to use the above....counts are not getting displayed....

am not getting the proper output....

sourav046sourav046

Hi Ramya !

 

I am not going into your code snippet .But I can suggest you try one thing :

 

1) go to Your Name>Setup>Administration Setup>Company Profile>Holidays

2)Click NEW to add holidays .

3)then put in your SOQL query 'holiday=true' something like that .

 

I am not sure this will help you or not .But if you were having problem in adding custom holidays then this will surely help .

 

Thanks and regards !