Показаны сообщения с ярлыком ax 2012. Показать все сообщения
Показаны сообщения с ярлыком ax 2012. Показать все сообщения

понедельник, 19 июня 2023 г.

Convert set to container X++

Recently I've faced with a task - I had two sets and I need to check item by item for both of them to identify number of common values. Going with Enumerator or Iterator would be the obvious way. However, I wanted to eliminate of ambiguous code and found different way. I converted SET to Container and checked elements one by one. Maybe it's not the best solution from performance standpoint (yes, I'm aware of slowness of containers), but it's the simplest one. So, the actual conversion of the Set to Container I did via next code:

Set incomeSet = new Set(Types::String);
cntainer outputCon;
//filling in set.
outputCon = condel(incomeSet.pack(), 1,3);
The
condel()
funciton deletes all special symbols and other staff and in the end you'll get something like that:

пятница, 17 апреля 2015 г.

How to get value divided by symbol AX 2012

Hi everyone.
Today I must create method, which had to create a list from current string value , divided by slash (/).
And I have written this code:

#Characters_CN
    List            list = new List(Types::String);
    ListIterator    iterator;
    container       packCon;
    int             slashCount = 0;

    list = strSplit(this.CoverSheetURL, #slash); //this.CoverSheetURL - your string value       iterator = new ListIterator(list);
    while (iterator.more())
    {
        packCon += iterator.value();
        slashCount++;
        iterator.next();
    }
    return conPeek(packCon, slashCount);


I hope, it will be useful for you :)