Friday, March 21, 2014

Sorting Cointainer

// Sorting Cointainer

static void SortContainer(Args _args)
{
container con = [5,1,2,'Sangeeth B.Tech',9, 'MBA Sangeeth', NoYes::No];
str temp1;
str temp2;
int i;
int j;
container sorCon;
;

sorCon = con;

// Sort the container
    for (i = 1; i <= conlen(sorCon); i++)
    {
        for (j = i + 1; j <= conlen(sorCon); j++)
        {
            temp1 = conpeek(sorCon, j);
            temp2 = conpeek(sorCon, i);

            if (temp1 < temp2)
            {
                sorCon = condel(sorCon, j, 1);
                sorCon = conins(sorCon, j, temp2);
                sorCon = condel(sorCon, i, 1);
                sorCon = conins(sorCon, i, temp1);
            }
        }
    }

conview(sorCon);
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...