ConPoke() Function in Container in X++ Language
Table of Content:
- The conPoke() is used to modify a container by replacing one or more of the existing elements.
- Syntax: container conPoke(container container, int start, anytype element, ...)
- container - The container to modify.
- start - The position of the first element to replace.
- element - One or more elements to replace, separated by commas.
- Return value: The new container with the inserted elements.
Example:
Code:
static void Container_conPokeExample(Args _args) { // container declaration and initialization with 2 values container containerName = ["Welcome", 1202]; // conPoke() function usage // (Replaces the value being held in a specific position in the container, with a new value) // Note: Here Replacing 2nd value (1202) with (29) in containerName containerName = conPoke(containerName, 2, 29); info(strFmt("Container containerName conPoke() values are :- %1, %2", conPeek(containerName, 1), conPeek(containerName, 2))); }
Output:
The above code will produce the following result-
Container containerName conPoke() values are :- Welcome, 29