TA

Hallo,

I have a problem when I create a report at ARIS 9.8.

I was upload file to Document Storage link. And I tried to create script but it's not work. Because script error.

var attrDoc = dataofModels5[z].Attribute(Constants.AT_ADS_LINK_1,nLocale);

 if (attrDoc != "Attr[4015,[Binary data], locale=1033]@0") {

      p_output.BeginSection(false, Constants.SECTION_DEFAULT)

     sectionPageSetup2( xx, p_output )

     var bytearray = attrDoc.getExternalDocument().getDocument();

     var docVal = Context.getOutputObject(file,bytearray);

     p_output.InsertDocument(docVal, false, false); 

     p_output.EndSection() 

 

Does anyone know how to get output file in document storage link??

Please help me. and thank you for your attention.

 

by Kay Fischbach
Posted on Mon, 11/25/2019 - 18:05

Unfortunately this seems to be a complicated topic.You can't use getExternalDocument() because the ADS is protected by authentication mechanisms. getExternalDocument is useful when you try to retrieve a document from a normal file system, like a shared network drive.

To retrieve files from the ADS you have to load the ADS report component and use that to get your file. Unfortunately the ADS report component only provides the file content as a Java InputStream, which makes things quite complicated.

Here is a very crude, but working approach. Feel free to improve it as much as possible.

var nLocale = Context.getSelectedLanguage();
var oOutput = Context.createOutputObject();
var selModels = ArisData.getSelectedModels();

var adsComponent = Context.getComponent("ADS");

for each(var mod in selModels){
    var adsAttr = mod.Attribute(Constants.AT_ADS_LINK_1, nLocale);
    var adsLink = adsAttr.getValue();
    
    var adsDocument = adsComponent.getDocumentByHyperlink(adsLink);
    
    var adsTitle = adsDocument.getDocumentMetaInfo().getFileName();
    
    var adsInputStream = adsDocument.getDocumentContent();
    
    var tempFile = java.io.File.createTempFile("temp", null, null);
    tempFile.deleteOnExit();
    
    var fileOutputStream = java.io.FileOutputStream(tempFile);
    
    while(adsInputStream.available() > 0){
        fileOutputStream.write(adsInputStream.read());
    }
    
    var bytes = java.nio.file.Files.readAllBytes(tempFile.toPath());
    
    var adsExtendedOutputObject = Context.getOutputObject(adsTitle, bytes);
    
    oOutput.InsertDocument(adsExtendedOutputObject, false, false);
}

oOutput.WriteReport();

 

Note here: I seriously hope that java.io.File.createTempFile(...) and tempFile.deleteOnExit() work as intended. It would be super bad if this would somehow leave remnants on the ARIS server, clogging the system.

Edit: after getting the byte array with java.nio.file.Files.readAllBytes(...) you can also call tempFile.delete() to delete the temp file. This ensures there won't be temp files piling up on your server.

0
by tuti all Author
Posted on Tue, 11/26/2019 - 09:38

In reply to by Kay Fischbach

Hallo Kay, 

I tried your script code, but i find a problem because function "getDocumentByHyperlink" and "getDocumentMetaInfo" are not available. How to call this function?? Can you explain it please??

Please help me, and Thank you for your attention..

0
by Kay Fischbach
Posted on Tue, 11/26/2019 - 10:06

In reply to by tutiall

I wrote this script and tested it with a patched version of ARIS 10.0.7. Can you tell me which ARIS version you're using?

May also be worth checking your report script help documentation for available Methods:

 

 

^ Those are the methods available for me. Follow the path on the left side to those classes and take a look.

0
by tuti all Author
Posted on Tue, 11/26/2019 - 10:52

In reply to by Kay Fischbach

oh I see,,  I'm sorry,, My ARIS version 9.8 .. so because this, there function not available for me yapp?

Do you have any other suggestion, please?

and to get document storage link is it posible for my aris version?? thank you for your attention.

 

 

0
by Kay Fischbach
Posted on Tue, 11/26/2019 - 14:59

In reply to by tutiall

We've had ARIS 9.8 in the past, but since then we've already had ARIS 10.3 and now ARIS 10.7, so it's been a while since I've used your ARIS version, sorry.

Can you use the search function in the top right corner of your script help to just search for "ADS", "document storage" or similar terms and see whether anything interesting pops up?

I must also correct myself, .getExternalDocument() can seemingly only be used to retrieve the document of the "Documentation" attribute, nothing more and nothing less (at least that's the methods capability here in ARIS 10.7). Anyways, I highly doubt that's the correct method. Maybe something else catches your eye in the script help?

0
by tuti all Author
Posted on Wed, 11/27/2019 - 07:22

In reply to by Kay Fischbach

oh it's ok,, never mind...

yappp I found a function "External HTML Document", i don't know what the function is yet, but it's interesting for me, and i will try it. Do u know about this function??

If anyone knows, please share with me.

Thank you for your attention..

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