Container Functions D365FO-AX 2012

Container Functions D365FO-AX 2012


Today, I am Sharing the functions of container, I have explored during in my career.


Container View

conView


Parameters

cconView(container,Caption,false);


reference screenshot



Insert in container



conIns


Parameters

conIns(container,position,anytype of value);

Example

   container   objContainer;
    int     position=1;
    // insert in container
   objContainer =conIns(objContainer,position,"Sohail Sheikh");

reference screenshot




Length of container 


conLen


Parameters

conLen(containerobject); // will return int

 Example

 container   objContainer=["Sohail Sheikh"];
    int     position=1,len=0;
    

 // container length   
   len=conLen(objContainer);
    info(strFmt("%1",len));

reference screenshot

Pull Data from container


conpeek


Parameters


conpeek(container,position)// will return anytype

Example
  container   objContainer=["Sohail Sheikh"];
    int     position=1;
    str objValue;

        
    // pull data from container   
    objValue=conPeek(objContainer,position);
        info(strFmt("%1",objValue));
 
reference screenshot




Replace Data of container

conpoke

Parameters

conPoke(container,position,anyvalue)// will return container

Example
   container   objContainer=["Sohail Sheikh"];
    int     position=1;
    str objValue;

        
    
     objContainer=conPoke(objContainer,position,"Sheikh Sohail Hussain");
    objValue=conPeek(objContainer,position);    
    info(strFmt("%1",objValue));

reference screenshot



Container Insert Operator 



Parameters


Example
    container   objContainer=["Sohail Sheikh"];
    int     position=1;
    str objValue;

        // insert using operator 
    objContainer+="Inserted";
       
    

    info(strFmt("%1,%2",conPeek(objContainer,1),conPeek(objContainer,2)));

reference screenshot




Find value in Container  

conFind


Parameters

conFind(container,anytype)// will return true or false


Example
 container   objContainer=["Sohail Sheikh"];
    int     position=1;
    str objValue;

        // insert using operator 
    objContainer+="Inserted";
    
      if(conFind(objContainer,"Inserted"))
    {
        info("Value found");
    }

   
reference screenshot





Delete value in Container  

conDel


Parameters

conDel(container,startPosition,EndPosition)// will return container

Example
container   objContainer=["Sohail Sheikh"];
    int     position=1;
    str objValue;

        // insert using operator 
    objContainer+="Inserted";
    
    info(strFmt("Container length Before delete %1",conLen(objContainer)));
    objContainer=conDel(objContainer,2,2);
  
   
   info(strFmt("Container length After delete %1",conLen(objContainer)));

    
reference screenshot





Container  to Str

con2Str


Parameters

conStr(container)// string

Example

  container   objContainer=["Sohail Sheikh"];
    int     position=1;
    str objValue;

        // insert using operator 
    objContainer+="Inserted";
    
    info(con2Str(objContainer));

reference screenshot




Container  Null

conNull


Parameters
conNull()// set the container null

Example
 container   objContainer=["Sohail Sheikh"];
    int     position=1;
    str objValue;

        // insert using operator 
    objContainer+="Inserted";
    
    info(strFmt("Container length Before set null %1",conLen(objContainer)));

 objContainer=conNull(); 
   

   info(strFmt("Container length After set null %1",conLen(objContainer)));


reference screenshot



Str to container

str2con


Parameters

str2Con(stringValues,separator);// will return container

 str objValue;
    container   objContainer;
    objContainer=str2con("Sheikh,Sohail",",");
    
    info(strFmt("%1",con2Str(objContainer)));



reference screenshot



No comments:

Post a Comment

Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...