Please enable JavaScript to view this site.

 

Navigation: Macros > Macro Language > Built-in Functions > All Functions

GetHolDurationPositionFromTable

Scroll Prev Up Next More

int = GetHolDurationPositionFromTable()

 

This macro function returns the position of the position of the current holiday in a multiday holiday.

 

This function returns 1 for single-day holidays.

 

The macro code below looks for the first holiday of nHolSetID on n_TokenDate and displays a message containing the number of days which this holiday lasts for, and in which position the current holiday is.

// initialize the holidays table
Reset_FindNextHolidayOnDate()
// check if there is a holiday today
if FindNextHolidayOnDate(n_TokenDate, nHolSetID)
   nNumDays = GetHolDurationFromTable()
   nPosition = GetHolDurationPositionFromTable()
   if nNumDays == 1
      sRESULT = 'Holiday only lasts one day'
   else
      switch nPosition
         case 1
            sRESULT = 'The first of ' + IntToStr(nNumDays) + ' days'
         case nNumDays
            sRESULT = 'The last of ' + IntToStr(nNumDays) + ' days'
         else
            sRESULT = 'Day ' + IntToStr(nPosition) + ' of ' + IntToStr(nNumDays)
      endswitch
   endif
endif

See also: GetHolDurationFromTable, FindNextHolidayOnDate.

 


Topic 178910, last updated on 18-Apr-2020