Please enable JavaScript to view this site.

 

void = List_Insert(sListVarName,nIndex,sSomeText,nSomeNumber)

 

This macro function is used to insert a string (sSomeText) and a number (nSomeNumber) before the nIndex element of an existing list.

 

In the image above the item Algeria=Algerien with number 10183 is inserted before the third item of the list. The code below is used to achieve this.

List_Clear(sListCountries)
// put some values in the list
List_Add(sListCountries, 'Egypt=Ägypten'10133)     // item 1
List_Add(sListCountries, 'Albania=Albanien'10165)  // item 2
List_Add(sListCountries, 'Andorra=Andorra'10167)   // item 3
List_Add(sListCountries, 'Armenia=Armenien'10180)  // item 4
// insert a new entry before the third element
List_Insert(sListCountries, 3'Algeria=Algerien'10183)  // item 3
// check that the new thrid element is the one we inserted
sResult = List_GetName(sListCountries, 3// 'Algeria' 

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_Add, List_Delete, List_Put, list macro functions.

 


Topic 188830, last updated on 28-Nov-2025