conNull() function in Container | X++ Language

Rumman Ansari   Software Engineer   2020-03-04   6516 Share
☰ Table of Contents

Table of Content:


  • The conNull() is used to retrieve an empty container. Use this function to explicitly dispose of the contents of a container.
  • Syntax: container conNull()
  • Return value: An empty container.

Example:

Code:


static void Container_conNullExample(Args _args)
{
    container containerName; // container declaration
    str charHolder;
    ;
    // container initialization with 4 values
    containerName = ["Finance", "T&L", "Retail", "Manufacturing"]; 

    // conNull() resets and returns an empty container
    // Here resets 4 values ("Finance", "T&L", "Retail", "Manufacturing") in containerName to null
    info(strFmt("Container containerName conNull() values before are :- %1 , %2, %3, %4",
    conPeek(containerName, 1), conPeek(containerName, 2),
    conPeek(containerName, 3), conPeek(containerName, 4)));
    
    containerName = conNull(); // set container null
    
    info(strFmt("Container containerName conNull() values after are :- %1 , %2, %3, %4",
    conPeek(containerName, 1), conPeek(containerName, 2),
    conPeek(containerName, 3), conPeek(containerName, 4)));

}

Output:

The above code will produce the following result-


Container containerName conNull() values before are :- Finance , T&L, Retail, Manufacturing
Container containerName conNull() values after are :- 0 , 0, 0, 0