void = Reset_GetNextDateForHolidayId()
This macro function moves the holidays table cursor back to the beginning of the table, and prepares its index for subsequent calls to the function GetNextDateForHolidayId.
The macro code below gets the first occurrence of a holiday of nHolId during nYear, and then lists all the other ones (if there are any).
Reset_GetNextDateForHolidayId()
// get first occurrence, if any
nCurDate = GetNextDateForHolidayId(nHolId,nYear)
if nCurDate > 0
sResult = 'Holiday occurs on ' + FormatDate('mmm d', nCurDate)
// check if there is another occurrence
nCurDate = GetNextDateForHolidayId(nHolId,nYear)
if nCurDate > 0
sResult = sResult + ', and on '
endif
while nCurDate > 0
sResult = sResult + FormatDate('mmm d', nCurDate) + ','
// check if there is another occurrence
nCurDate = GetNextDateForHolidayId(nHolId,nYear)
endwhile
else
sResult = 'No occurrence in ' + IntToStr(nYear)
endif
See also: GetNextDateForHolidayId and Reset_FindNextHolidayOnDate.
Topic 110056, last updated on 18-Apr-2020