Profile picture for user egambrell

I am trying to build an ARIS report that will read and write to Excel files on a shared drive. I've tried mapping these shared drives on the ARIS server. Both the read and write reports will automatically run on a nightly basis, so this is not a report where I can have the user select the Excel file that they are using.



For instance, I mapped one to the Z drive and then tried the following:

var filePath = "Z:\\ExcelImportFile.xlsx";

var file = new java.io.File(filePath);

var fileStream = new java.io.FileInputStream(file);

var bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, file.length());

fileStream.read(bytes);

fileStream.close();

return bytes;

It says that it cannot find the path specified.

I've also tried the actual name of the remote server i.e. "\\\\us-shared-drive\\ExcelImportFile.xlsx"

I have seen quite a few options online for reading a file from a shared drive and including credentials, but they all require Java packages that are not included in the API.

Has anyone done something similar? Is there a way to do this in ARIS that can allow me to pass the credentials needed for the shared drive? What am I missing/

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Fri, 09/02/2016 - 08:17

Hi Ellen,

I am using for those cases the scriptrunner which can be called from bat-file. And in the bat-file, we are on the ARIS server itself so we can e.g. rename or move the created files...

BR Robert

0
by Ellen Gambrell Pelletier Author
Posted on Fri, 09/02/2016 - 18:14

In reply to by rgoldenbaum

Hi Robert - Thanks for your reply. I can use scriptrunner if I'm running it nightly, but we also want users to be able to execute the import/export on the fly. I don't think there's any way to kick off a bat file via an ARIS report because of the same predicament.

0
by Ellen Gambrell Pelletier Author
Posted on Fri, 09/02/2016 - 18:15

In reply to by rgoldenbaum

Hi Robert - Thanks for your reply. I can use scriptrunner if I'm running it nightly, but we also want users to be able to execute the import/export on the fly. I don't think there's any way to kick off a bat file via an ARIS report because of the same predicament.

0
by Tricarico Romain
Posted on Sat, 09/03/2016 - 02:18

Hi Ellen,

Did you check the Aris server has read/write privileges on your share drive? Don't forget the script is running from the Aris Server and not from your computer, so appropriate rights have to be defined on the server side.

Best Regards. 

Romain Tricarico

www.bpmap.fr

0
by Ellen Gambrell Pelletier Author
Posted on Mon, 09/05/2016 - 21:37

Hi Tricarico -

I personally can map the drive and read/write to it (my username has access). But since the ARIS service is running as the local system, I'm unsure how to give the server itself access. I've tried switching the ARIS service to run as a service account rather than the local system, but after that change, the postgresECP runnable fails.



- Ellen

0
by Ellen Gambrell Pelletier Author
Posted on Tue, 09/06/2016 - 16:57

Update - I've asked to have the actual servername have permission to read/write to the group. Rather than the mapped path, which would only be used for my profile, I am trying to pull the file from the shared drive name:

var filePath = "\\\\server-domain-name\\shared-folder\\excel-file.xlsx";

Still no luck - it does not find the file path when I run the report.

0
by Szymon Sobkowiak
Posted on Fri, 12/09/2016 - 11:05

In reply to by egambrell

Hello

I remember that ARIS Service (on server side) has to be started using domain user which has privileges to read/write on specified network path.

So check if ARIS Service is started using such user

If yes - script can use following method to get specified file

'\\\\server\folder\file.ext'

 

Best Regards

Szymon Sobkowiak

0
by Yuriy Stolyarov
Posted on Thu, 07/30/2020 - 18:02

Hello

May be this can help you:

function getFileFromFolder( filePath ) {
    var file = new java.io.File(filePath);
    var fileStream = new java.io.FileInputStream(file);
    var bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, file.length());
    fileStream.read(bytes);
    fileStream.close();
    return bytes;
}

function main() {

var importFile = getFileFromFolder( "C://TEMP//1.xlsx" );
    if (importFile != null) {
        var workbook = Context.getExcelReader(importFile); 
        var workSheet = workbook.getSheets();
        var word_1 = workSheet[0].cell( 0, 0 ).getCellValue();
        var word_2 = workSheet[0].cell( 0, 1 ).getCellValue();
        Dialogs.MsgBox("Dialog_2:" + word_1 + word_2);
    }

}

0
by Yuriy Stolyarov
Posted on Thu, 07/30/2020 - 18:04

In reply to by Felix101

The second variant of function "getFileFromFolder":

function getFileFromFolder2( filePath ) {
    return new java.nio.file.Files.readAllBytes(new java.nio.file.Paths.get(filePath));
}

0
by Yuriy Stolyarov
Posted on Thu, 07/30/2020 - 18:24

In reply to by Felix101

But if I try the path of network folder, I get the error: "The account used is a computer account. Use your global user account or local user account to access this server."

Tell me please how can I use the user account in the script?

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