Please enable JavaScript to view this site.

 

bool = FindNextHolidayOnDate(nDate,nHolSetID)

 

This macro function will look for the next holiday of the holidays set of ID nHolSetID, on the date nDate.

 

This function does not look for one-time-dates.

The search is within a single holidays set. There is an example, further down on this page, on how to loop over all the holidays sets of an aeiou-holidays list.

 

This function is based on the current position of the holidays table's cursor and, if a next holiday is found, then the table's cursor is moved to that next holiday. To search for the first holiday of the holidays set nHolSetID on the date nDate, you need to first call the function Reset_FindNextHolidayOnDate to move the table's cursor back to the beginning of the table.

 

Looping over the Holidays of a Holidays Set

 

Below is an example of the use of the function FindNextHolidayOnDate to iterate over all the holidays of nHolSetID on nDate.

// get all the holidays of nHolSetID on nDate
sRESULT = ''
// move the table's cursor back to the beginning
Reset_FindNextHolidayOnDate()
// look for all holidays on same date
while FindNextHolidayOnDate(nDate,nHolSetID)
   sRESULT = sRESULT + chr(13) + GetHolNameFromTable()
endwhile

In the above example, note that the call to FindNextHolidayOnDate expects nHolSetID to be the ID of the holidays set, not its name. The ID of a holidays set can be found in the holidays sets properties dialog.

 

Looping over the Holidays of all Sets of an aeiou-Holidays List

 

The above example only looped over the holidays of one specific holidays set. Below is an expanded version of the above macro, which now loops over all the holidays sets of the a-holidays on nDate.

// get all the holidays of nHolSetID on nDate
sRESULT = ''
sCurHolList = SetHolidaysList('a')
nListIndex = 1 // the index position in the a-holidays list
nHolidaysSetID = GetNthHolSetId(sCurHolList, nListIndex)
// loop over the HolidaySets in current Holidays List
while nHolidaysSetID <> 0
   // use the current Holidays Set Id (nCurHolSet)
 
   // move the table's cursor back to the beginning
   Reset_FindNextHolidayOnDate()
   // look for all holidays on same date
   while FindNextHolidayOnDate(nDate,nHolidaysSetID)
      sRESULT = sRESULT + chr(13) + GetHolNameFromTable()
   endwhile   
 
   // when you are done, prepare for next iteration   
   inc(nListIndex)
   nHolidaysSetID = GetNthHolSetId(sCurHolList, nListIndex)
endwhile

In the above example, note that the call to FindNextHolidayOnDate expects nHolSetID to be the ID of the holidays set, not its name. The ID of a holidays set can be found in the holidays sets properties dialog.

 

See also: Reset_FindNextHolidayOnDate, GetHolNameFromTable, SetHolidaysList, GetNthHolSetId.

 


Topic 105133, last updated on 01-Aug-2020