PP

Hey Everyone,

I´m having some trouble with a report in my company and cannot get around to it.

There is one specific model attribute that is supposed to be filled with as many values as needed. It is a glossary of technical terms. I need to output the value of this attribute to a table in the report, and this table should be made of as many rows as the number of technical terms and definitions that were filled in the attribute´s value.

To make sure I made it clear, here is an example:

The Attribute value reads: "term1: definition1; term2: definition2; term3: definition 3;(...);termX: definitionX"

The result in the report should be a table with two columns that looks something like:

Term1: Definition1

Term2: Definition2

Term3: Definition3

(...)

TermX: Definition X.

 

I hope I could make myself clear. Any help towards achieving that would be greatly appreciated. 

Thanks in advance to everyone in the community. 

 

by Kay Fischbach
Posted on Tue, 11/27/2018 - 15:34

Don't know if you know how to get the Attribut value, I'll just write it here to make sure it's there

var attrValue = modelObj.Attribute(REPLACE_THIS_WITH_THE_ATTR_TYPE_NUM, Context.getSelectedLanguage()).getValue();

Hmm, might be a bit primitive, but I would use the Javascript String.split() function.

See https://www.w3schools.com/jsref/jsref_split.asp to read how exactly it is used.

Basically you will split your string first at each semicolon + space occurrence, and the result of that, before adding it to the return-array, will be split once more at every colon + space occurrence.

function buildArray(stringToBuildWith){
        var initialSplit = stringToBuildWith.split("; ");
        var arrToReturn = [];
        
        for each(var singleInitialSplit in initialSplit){
            arrToReturn.push(singleInitialSplit.split(": "));
        }
        
        return arrToReturn;
        
    }

With this method (or something similar) you can build yourself a two dimensional array, where elements in the top array represent a term+definition combination, and then the lower level array has two values: the individual term and the individual definition.

You can then create a table, and handle the row creation with a loop through the created 2D array.

p_output.ResetFrameStyle();
p_output.BeginTable(50, [50, 50], Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0);
for each(var builtArrayElement in buildArray(attrValue)){
    p_output.TableRow();
    p_output.TableCellF(builtArrayElement[0], 1,1, getString("ID_STYLE_RD_DEFAULT"))
    p_output.TableCellF(builtArrayElement[1], 1,1, getString("ID_STYLE_RD_DEFAULT"))
    
}

p_output.EndTable("", 50, getString("ID_DEFAULT_FONT"), 11, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT, 0);

Of course you can supplement the whole thing with checks whether or not stuff is null, or arrays aren't accessed out of bounds, but I wrote my example plain and simple for the ideal case.

0
by Pedro Peregrino Author
Posted on Tue, 11/27/2018 - 17:23

This is great @Kay, thanks for the help.

I was aware that this could be achieved using JavaScript, but I wanted a way of doing that in the WYSIWYG editor, since most of the BPM team does not have programming skills. 

Thanks for the solution for now. If anyone else can think of an alternative way of achieving this via the visual editor, it would be greatly appreciated.

 

0
by Kay Fischbach
Posted on Wed, 11/28/2018 - 09:01

In reply to by pedroperegrino

The data you want to print is not stored in atomic form (see "database 1NF" for more information), and therefore it is impossible to print it in the way you want it, without splitting it up first. Splitting data is not possible with the WYSIWYG editor.

If you want to rely purely on the WYSIWYG editor I suggest you take the clean approach: ARIS has an object type called "Technical term", which has an attribute called "Name" and an attribute called "Description/Definition" - use multiple of those to store your data in atomic form. Then you can easily use the WYSIWYG editor to ask for object occurrences within the model of the type "Technical Term".

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
  • Profile picture for user frankweise
  • Profile picture for user Henrik Buckler
  • Profile picture for user UffeK
  • SS
  • MZ
  • PacMan

Leaderboard

|
Nobody has collected any points yet this week. This is your chance to become one of the top 5 on this week's 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