With the release of expressor 3.3, expressor software has added a significant new feature to the expressor Studio tool – the ability to easily extend functionality through the incorporation of reusable script files. A developer using expressor Studio may write these scripts and add them to any number of projects, or you can integrate scripts written by other developers. Let’s see how this works.
Suppose you want to execute a one-to-many application in which each incoming record needs to be parsed into multiple output records. For example, a record containing monthly data over a year period needs to be reworked so that each emitted record contains data from a single month. The following fragment shows two representative data records, where the first field is the year and the following fields are the monthly data, January through December.
Year,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec 2010,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012 2009,901,902,903,904,905,906,907,908,909,910,911,912
You want each output record to contain only three fields: Year, Month, and Value.
Year,Month,Value 2010,Jan,1001 2010,Feb,1002 2010,Mar,1003 2010,Apr,1004 ...
To illustrate how you can reuse the coding within a Datascript Module, think of the incoming record as a sequence of fields each with a specific attribute name and value.
And think of each emitted record as comprised of three fields.
Now you can write generic code within the Datascript Module that can handle any incoming record in a one-to-many application.
Now, let’s turn our attention to the code that uses this Datascript Module. In this case, the application is quite simple. It reads a file that contains the yearly summary records, uses a Transform operator to process each record into multiple output records, and then writes each monthly output record to a file.
Using modules written by other developers is no more involved. In fact, expressor 3.3 ships with many modules that your code can utilize. These include a cURL module that you can use to invoke on Web services or FTP servers, a SAX XML module that you can use to parse an XML document, a socket module that you can use to interact with an external application, a SQL module that allows your code to execute a SQL statement against a remote database, as well as some expressor Datascript Modules that include utility functions useful for parsing CSV files and serializing and de-serializing expressor Datascript tables.
To use any of these modules, simply include the necessary require statement at the beginning of your scripting. The expressor Community Knowledge Base includes entries that describe use of these modules. The expressor Studio desktop ETL tool is freely downloadable from the expressor website. I encourage you to give it a try!
Reference: Pinal Dave (http://blog.SQLAuthority.com)