List.SetValue
-------------

Sets a value in the list.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [List](component_List.md) | [7.1](newinversion71.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "List.SetValue"; List; Index; Text ) 

**MBS**( **"List.SetValue";** /\* Sets a value in the list. \*/  
**$List**; /\* The list to process.e.g. "Hello" ¶ "" ¶ "World" \*/   
**$Index**; /\* The index of the value to set.   
Must be in range from 0 to ValueCount(List). \*/   
**$Text**) /\* The text to add.e.g. "Hello" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| List | The list to process. | "Hello" ¶ "" ¶ "World" |
| Index | The index of the value to set.    Must be in range from 0 to ValueCount(List). | $index |
| Text | The text to add. | "Hello" |

### Result

Returns list or error.

### Description

Sets a value in the list.  
If index is equal to count, we append the text to the list.  
For big lists, using QuickList functions is much faster. The list is only parsed once and stored in memory.  
### Examples

Replaces second value with a new text:

 MBS ( "List.SetValue"; "Hello¶World"; 1; "Third" )  
<small>  
Example result:   
Hello  
Third</small>### See also

- [List.AddValue](ListAddValue.md)
- [List.GetValue](ListGetValue.md)
- [List.HasValue](ListHasValue.md)
- [QuickList.SetValue](QuickListSetValue.md)

### Release notes

- **Version 7.1**
    - Added [List.AddValue](http://www.mbsplugins.eu/ListAddValue.shtml), [List.GetValue](http://www.mbsplugins.eu/ListGetValue.shtml), [List.InsertValue](http://www.mbsplugins.eu/ListInsertValue.shtml), [List.Remove](http://www.mbsplugins.eu/ListRemove.shtml), [List.RemoveValue](http://www.mbsplugins.eu/ListRemoveValue.shtml) and [List.SetValue](http://www.mbsplugins.eu/ListSetValue.shtml).

This function checks for a license.

Created 11st March 2017 , last changed 15th January 2024

  
[List.Serialize](ListSerialize.md) - [List.Shuffle](ListShuffle.md)

[HTML Version](ListSetValue.shtml)