Geeks With Blogs

Tim Huffam Dotting the I and crossing the T of I.T.

The Aris scripting language provides a couple of ways to select and read a file for input.  This is useful for auto populating Aris (generating models and objects).

To select a file on the clients machine:

Aris provides a dialog for selecting a file on the users machine.  This returns an array of file objects, each of which have a method which returns a byte array (which seems to be the standard way to handle file content in Aris). Eg:

    // Get file from client
    var selectedFiles = Dialogs.getFilePath(null, "XML Files|*.xml||", null, "Select file", 0);
    if(selectedFiles==null){
        Dialogs.MsgBox("No file selected.");
        return;
    }
    var fileByteArray = selectedFiles[0].getData();
 

To use a file on the Aris Server:

Alternatively you can just access a known file from the Common Files area.  To put the file there in the first place you need to add it within Aris (from the Scripting module open the server, right-click on "Common files" and select "Add files..." etc).  Then use the Dialogs.getFilePath() method, eg:

    // Get file from Common files
    var fileByteArray = Context.getFile("myInputFile.xml", Constants.LOCATION_COMMON_FILES);
 

HTH
Tim

Posted on Wednesday, March 3, 2010 3:35 PM Architecture, Design and Development , Modelling, Aris, etc | Back to top


Comments on this post: Reading a file for input in Aris, using Aris Script (Server/Report)

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
hello,
thanks for this code. I want to create objects in aris from an input file(input Excel). How can do it?
Left by abdelghani on Aug 23, 2010 2:48 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Here is how to get an Excel file as input in your ARIS program:

// Get Excel input file
var selectedFiles = Dialogs.getFilePath(null, "XLS Files|*.xls||", null, "Select file", 0);
if(selectedFiles==null){
Dialogs.MsgBox("No file selected.");
return;
}
fileByteArray = selectedFiles[0].getData();
xlsWorkBook = Context.createExcelWorkbook(selectedFiles[0].getName(), fileByteArray);
Left by jjmcinto on Feb 21, 2011 8:51 PM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
I am happy to find so many useful information here in the post. Thanks
Left by white label domain on May 12, 2011 4:21 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Great blog, keep it up
Left by luxury spa hotels on May 17, 2011 9:32 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
This is a really interesting topic. Thanks.
Left by Train your brain on May 23, 2011 4:11 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
seems good. I'll try it. thanks.
Left by Boat Rentals Singapore on May 24, 2011 2:39 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Thanks a bunch for this. Learnt a lot!
Left by stretching exercises on May 26, 2011 5:34 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Thanks for the code =) vacations for singles
Left by Vacations of Single on Jun 17, 2011 3:54 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
You can enroll in a four-week Intensive TEFL course – a certificate course – conducted by one of the world's largest accredited TESOL and TEFL course providers. Upon completion of the tesol courses you will have the credentials required to work or Teach English Abroad as a teacher in non-native English speaking countries.
Left by tefl course on Jul 04, 2011 6:17 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
As teacher training in India is gaining grounds, American TESOL Institute (ATI) offers nursery teacher training and primary teachers training courses to aspiring teachers with specialization in teaching English. These courses are designed to equip teachers with various innovative teaching techniques.
Left by initial teacher training course on Jul 04, 2011 6:18 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
BrisPlanner.com is an informative and useful online guide targeted at parents of newborns who wish to have detailed information and resources on the Jewish Brit ceremony, getting deals and discounts, finding the right Mohel, checking out vendor list and celebrating their bris jewish ceremony with joy.
Left by bris ceremony usa on Jul 04, 2011 6:18 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Motorcycleaccidentcenter.com is an online portal dedicated to helping those injured in a motorcycle accident through the negligence of others. You will be assured the best legal advice and support from expert motorcycle accident lawyer.
Left by motorcycle accident lawyer on Jul 04, 2011 6:19 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
The Jewish tradition of sitting shiva that continues for the first seven days can be very exhausting both physically and emotionally for the mourners. This is true especially for the Shiva captain and other direct mourners because the Jewish tradition of Shiva needs to be followed intensely and meticulously. There are a number of restrictions and prohibitions for the whole of one week when one sits shiva.
Left by shiva platter on Jul 04, 2011 6:22 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
An investigation shows that female workers tend to have a favorable attitude toward retirement.
Left by Jordan Max Fusion on Sep 20, 2011 1:55 AM

# great
Requesting Gravatar...
Outstanding piece of work you have done. This type of posts is rarely found. This site has proved its metals in the way of giving extra ordinary information.

thailand flower delivery | send gifts to turkey
Left by linda martin on Oct 10, 2011 1:40 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
tx a lot for the info. It really helped me a lot. (and a lot of other people too as I see)
Left by Beer Fridge on Nov 29, 2011 2:44 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Helpfull article. This is the stuff I had to learn in school class last month. It would have been usefull to have this article back then. slush machine || Beverage Dispenser
Left by slush machine on Nov 29, 2011 2:53 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Riproduzioni handmade/copia della pittura a olio di qualità del museo degli artisti famosi - vecchi maestri & contemporaneo.
Left by galleria di arte on Dec 27, 2011 12:17 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Wahoo Art Gallery presents valuable collection of painting of several centuries, from different parts of the world. It also shares valuable information about famous artists together with their contribution in the world of painting. In addition to these, visitor also gets a chance to reply and customize famous painting of their choice Wahoo art in-house team of skilled artists. Unwind yourself as you move through this creative world of paintings.
Left by galleria di arte on Jan 09, 2012 12:07 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Thanks, it was very usefull.
Left by Nicolas Pozo on Jan 30, 2012 12:06 PM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Helpful indeed! Lot of helpful stuff I have found in the geekswithblogs dot net...
Left by Ambit Energy on Feb 22, 2012 9:49 PM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Now i'm enthusiastic ones own solutions thinkings, in which the software tremendously delighted nearly everybody fascination with the following discipline determined the solution, where this perform it's magic ought to become ended about effectively and also enjoy it for anyone tips you undoubtedly noted!
Left by Instagram For Android on Apr 10, 2012 12:53 PM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
Using a stocks tip list like this is a smart move to make if you are inexperienced or don't have the time to put towards analytics yourself like hardly any of us do.
Left by intraday tips on Apr 19, 2013 6:20 AM

# re: Reading a file for input in Aris, using Aris Script (Server/Report)
Requesting Gravatar...
how To select a file on the clients machine i Understant
Left by may loc nuoc on May 07, 2013 1:22 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net