Please enable JavaScript to view this site.

 

void = List_Clear(sListVarName)

 

This macro function is used to remove/clear, all the elements of an existing list.

 

The macro below is the beginning of a macros which uses an override list of country names to replace the country names in the holidays table (this macro is shown in more details here). Here we use the function List_Clear to ensure that the list sListCountries is empty before we start filling it.

// load the list of country names override
List_LoadFromFile(sListCountryNameOverrides, sFileCountryNames, true)
List_Sort(sListCountryNameOverrides)
List_RemoveDuplicates(sListCountryNameOverrides)
nNumCountryOverrides = List_Count(sListCountryNameOverrides)
// make sure the list to be filled is empty
List_Clear(sListCountries)
// loop over the sets in the a-holidays
nSetIndexPos = 1
nSetID = GetNthHolSetId('a', nSetIndexPos)
while nSetID <> 0
    // ...
    // ...
    // ...
    // move to next SET of the LIST
    nSetIndexPos = nSetIndexPos + 1
    nSetID = GetNthHolSetId(sCurHolList, nSetIndexPos)
endwhile
List_Sort(sListCountries)

When using lists, don't forget to always use the function List_Create to create your list at the top of the macro, and then the function List_Destroy to destroy it at the end of the macro.

 

See also: list macro functions.

 


Topic 178335, last updated on 18-Apr-2020