AG

Dear community,
I have to ask for help again. I've been dealing with the issue for several days now but I can't find a solution.

I have an array with nested arrays. An example of an array fragment is presented below. The array is sorted by the zero and second elements of nested arrays. All elements of nested arrays are string data type.

[[Process 1, Role 1, Function 1.1, Connection type A],
[Process 1, Role 1, Function 1.2, Connection type B],
[Process 1, Role 2, Function 1.3, Connection type C],
[Process 1, Role 2, Function 1.4, Connection type A],
[Process 2, Role 3, Function 2.1, Connection type A],
[Process 2, Role 14, Function 2.2, Connection type A],
[Process 3, Role 55, Function 3.1, Connection type A]]

I need to output this array to a table in Microsoft Word format. There are no problems with this. I also understand how to statically program the output of the table.

 

 

The problem is that I need to do a dynamic join of cells in the first and second columns. At the same time, the number of merged rows is random and can be any.

I have already come up with an algorithm that combines cells in the 1st column. But I can't come up with an algorithm that would combine the cells in the first and second columns.

In short, my algorithm is as follows:

In short, my algorithm is as follows:
1. I'm going through the array in search of a series of identical business processes following each other in the first column. The lengths of the series I write to an array.
2. I cut off a piece from a large array, equal in length to the first series.
3. I'm going through it, looking for a series of identical roles following each other in the second column. I also write the lengths of these series into an array (and I don't use it in any way yet).
4. I'm building a piece of the table.
5. I cut the next piece from a large array, equal in length to the second series.
6. I'm building a piece of the table.
7.... and so on

Below is the code for forming the body of the table. This code works and correctly forms a table with merged cells in the first column.
But I still can't figure out how to integrate the second part into it, combining cells in the second column.
Maybe I chose the wrong path at all, and there is a much simpler algorithm. But this is my second script in Aris and I'm still very inexperienced :(

    var countBpArray = count(bigArray,0);
    for (var i=0; i<countBpArray.length; i++){
        var peaceOfBigArr = bigArray.splice(0,countBpArray[i]);
        oO.TableRow();
        oO.TableCell(peaceOfBigArr[0][0],countBpArray[i],1,"Times New Roman",8,Constants.C_BLACK,Constants.C_TRANSPARENT,0,Constants.FMT_LEFT,0);
        oO.TableCell(peaceOfBigArr[0][1],1,1,"Times New Roman",8,Constants.C_BLACK,Constants.C_TRANSPARENT,0,Constants.FMT_LEFT,0);
        oO.TableCell(peaceOfBigArr[0][3],1,1,"Times New Roman",8,Constants.C_BLACK,Constants.C_TRANSPARENT,0,Constants.FMT_LEFT,0);
        oO.TableCell(peaceOfBigArr[0][4],1,1,"Times New Roman",8,Constants.C_BLACK,Constants.C_TRANSPARENT,0,Constants.FMT_LEFT,0);
        if (countBpArray[i]>1){
            for (var j=1;j<countBpArray[i];j++){
                oO.TableRow();
                oO.TableCell(peaceOfBigArr[j][1],1,1,"Times New Roman",8,Constants.C_BLACK,Constants.C_TRANSPARENT,0,Constants.FMT_LEFT,0);
                oO.TableCell(peaceOfBigArr[j][3],1,1,"Times New Roman",8,Constants.C_BLACK,Constants.C_TRANSPARENT,0,Constants.FMT_LEFT,0);
                oO.TableCell(peaceOfBigArr[j][4],1,1,"Times New Roman",8,Constants.C_BLACK,Constants.C_TRANSPARENT,0,Constants.FMT_LEFT,0);
            }
        }
    }

 

 

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Mon, 08/15/2022 - 11:05

Hi Anton,

hm, why don't you just:

1) Read the role-definitions from the process

2) Check the number of occurrences each role has and the number of connections each occ has (=> functions)

e.g. Role 1 has two occs in process one with one cxn each => role 1 has 2 rows and adds a total of 2 rows to the process.   Role 2 has two occs in process one with one cxn each => role 1 has 2 rows and adds a total of 2 rows to the process

3) Output the table process row (in example with 2+2 rows), output role 1 (in example with 2 rows), output function 1.1 (in example 1 row), output cxn (in example 1 row)

Should work like this...

Regards, Robert

0
by Anton Golovanov Author
Posted on Mon, 08/22/2022 - 08:52

In reply to by rgoldenbaum

Hi Robert,

I apologize for the delay in answering, but as they say: better late than never :)
Thank you so much for your advice! I recorded it in my electronic "piggy bank of knowledge". As a novice programmer, any information is useful to me.
Unfortunately, I won't be able to apply this advice now. However, I finally solved the problem. Perhaps the algorithm turned out to be cumbersome, but it works.  And this is the main thing.

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock