Показать сообщение отдельно
Старый 22.04.2011, 04:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
dax-lessons: Sort a container [using X++ , Dynamics AX]
Источник: http://dynamicsaxgyan.wordpress.com/...x-dynamics-ax/
==============

Friends, Recently I was in need of sorting the elements in the container and use them . I am not sure how far this code is helpful to you guys. Below code will help to sort the elements in the … Continue reading →
X++:
static void SR_sortContainer(Args _args)
{
    container con = [5,1,2,'Sumit Loya',9, 'Ashish singh', 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);
}
Источник: http://dynamicsaxgyan.wordpress.com/...x-dynamics-ax/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось Poleax; 22.04.2011 в 10:45.