Support of basic operations on Sets in Dynamics AX

 
Good morning
 
AX supports basic operations on sets, here’s a simple overwiew:
 
public static void OperationsOnSets(Args _args)
{
    Set a = new Set(Types::Integer); //[1,3]
    Set b = new Set(Types::Integer); //[2,3]
    Set c = new Set(Types::Integer); //Result
    ;
 
    a.add(1);
    a.add(3);
    b.add(2);
    b.add(3);
 
    c = Set::union(a, b);          //[1,3] U [2,3] Result: [1,2,3]
    c = Set::intersection(a, b); //[1,3] ∩ [2,3] Result: [3]
    c = Set::difference(a, b);   //[1,3] – [2,3] Result: [1]
}
This entry was posted in Dynamics Ax 4.0x. Bookmark the permalink.