Home arrow Tutorials arrow All about scripts and Author Mode

CONTENT WARNING

This site refers to our older, server-based product. If you are interested in our new, Excel-based product, please see our main web site at http://www.nextanalytics.com

All about scripts and Author Mode

In this first lesson, we start with an explanation of Nextanalytics scripting. It is fundamental to understanding the core advantages of using nextanalytics with your BI tools, charting packages and spreadsheets.

Scripts commands tell the analytic engine what to do but, more importantly, the scripts execute one line at a time such the results from one command automatically becomes the input to the next command. This simple approach to sequential data processing has tremendous advantages over query and formula based products. Since the script commands act on the current page, regardless of where it came from, they tend to be highly portable and easily be re-used with other sets of data.

Running a Project Script

When you launch Author Mode, you can choose to open and existing project. The list of files is obtained from the projects directory as configured in your nextanalytics installation. When you select a project file name from the list, the project's script is run, and the resulting 'pages' are shown. You can see the most recent page from the script (we call this the "Selected Page" in our scripting terminology). It also has a Dropdown list of other pages, in case you want to select a different page.

Creation of Scripts

Project script files are simple text files, and can be editted with any text editor. In most solutions, scripts can be recorded using Author Mode. The benefit of this approach is that Author Mode has a wide range of user friendly dialog boxes which thoroughly explain the parameters for each command. When you make a change, the data is processed and you can see the new script entries in the script window visible with the File-Save/View... menu item. The script window lets you see the script that was generated by menu selections.

You can change the script directly in the script window. The dialog boxes become useful for experimenting with parameters to see the effect and to learn what the syntax was for a particular script command. After you have saved a project file, you will be able to see the project file name in the list.

Since the product is running in a web environment, the 'undo' function is simply your browser's Back button. Click Back until you see the state desired, then click the File-Save menu to update your project file.

Deploying a List of Projects 

If you are planning a deployment to a user base, Author Mode is probably too much for many business people, so we include a sample Dashboard with the product that you can use to build your own solution.

The architecture lends itself to a great deal of flexibility. The Dashboard simply supplies a project file name to the analytic engine, the script is executed, and the resulting data is available for display. The source code for the Dashboard is provided so it can be easily customized to suit your needs or used as a template to build your own.

Planning Your First Project

While reading the topics in this tutorial, you might be tempted to work with your own CSV file, and that is a simple option when you start Author Mode. 

Be sure to select the File-Save As... menu item to save the project to a file name that you will recognize.  After that, you can come back to it in future sessions.  If you experiment with the menus and dialog boxes, you will see the effects of your actions in the resulting script. Those changes are not saved until you select one of the the File-Save menu items. 

The reason that we require you to save the project manually is so that you can press your browser's Back button to undo the changes you have made. This makes it easy for you to experiment and learn.

How to Handle Mistakes in a Script

If you have edited the script directly and then pressed the Save/Run, it is inevitable that you will make a typing mistake that causes a script error. Click the browser Back button to a previously good state and select the File-Save menu item. If you can't recover this way, you can always edit the text file directly with a program that can read and write text files like Notepad. 

Conclusion 

Now let's explore some of Nextanalytics' capabilities. We're going to start with the basics and build. There are over a hundred functions or operations you could learn about. We've decide to group that into about thirty to forty topics. They're not dependent, so you can skim or skip areas that you're not interested in.

You can search the site (as well as the entire internet) for one of our topics.  Chances are that a reference topic exists, as well multiple examples will likely show up in the search.