Profile picture for user MoellerBennet

Hi,

I am trying to use a Javascript Map in a Report, but when I try to create a Map like this:

var newMap = new Map([
    ["key",value]
])

I get  "ReferenceError: "Map" is not defined."

How can I use JavaScript Maps in ARIS Script?

Kind Regards,

Bennet

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 09/13/2022 - 12:34

var g_mModelsCreated = new java.util.Hashtable();

g_mModelsCreated.put(..., ...)

1
by Bennet Möller Author
Posted on Tue, 09/13/2022 - 13:55

In reply to by rgoldenbaum

Thank you for the Reply, Robert!

Fixed one issue, but now I have another problem here: (This code window seems to be a bit broken, I hope its still somewhat readable...)

myMap.forEach(function (key, value) {
        outfile.TableRow();
        outfile.TableCell(key,20,"Arial",10,Constants.C_BLACK,Constants.C_WHITE,0,Constants.FMT_CENTER,0);
        outfile.TableCell(value,20,"Arial",10,Constants.C_BLACK,Constants.C_WHITE,0,Constants.FMT_CENTER,0);
    })

I get the following error now: "Cannot convert function to interface.java.util.function.BiConsumer since it contains methods with different names"

Do I have to change my foreach implementation?

Best regards,

Bennet

1
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 09/13/2022 - 14:29

I always do it like this:

    asKeySet = g_mConnectionsFound.keySet().toArray();
    for (i = 0; i < asKeySet.length; i++){
        sValue= g_mConnectionsFound.get(asKeySet[i] + "");

 

outfile.TableRow();    outfile.TableCell(asKeySet[i],20,"Arial",10,Constants.C_BLACK,Constants.C_WHITE,0,Constants.FMT_CENTER,0); outfile.TableCell(sValue,20,"Arial",10,Constants.C_BLACK,Constants.C_WHITE,0,Constants.FMT_CENTER,0);
    }

1

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • CR
  • BH
  • Profile picture for user Ivan.Ivanov.softwareag.com
  • Profile picture for user mscheid
  • MS
  • PacMan

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