Need an account? Click to Register
Home arrow Learn arrow Reference arrow AddPage
AddPage

This function adds data from a CSV formatted file. Just prior to reading the data, it reads a separate text file that contains a description of the CSV file so that the engine can run more optimally.

nextanalytics engine script commands are designed to work on data columns.  To make them run better, nextanalytics needs to know which column is the rowlabel, and which ones are text, which ones are numeric, and which ones should be ignored. 

AddPage is used in situations where an incoming file doesn't contain any hints about roles of the columns in the data file.   For an explanation of hints, study the AddData command.

The secondary text file is called a page file and there may be one or more in the pages directory, as specified in your variables.config file.

Inside one of these files is a description of the roles that each data column plays. 

The page file can be used to describe multiple CSV files. This is ideal in situations where multiple CSV files might be all alike except perhaps in number of records or date/time of generation.

Syntax:

AddPage , pageFileName, csvFileName

Parameters:

AddPage is given two file names. If you have given the files extensions, don't forget to include them as part of the parameter. The directories where the files are located are configured in your variables.config file.

The first parameter identifies a file that contains a text record which describes the purpose of each column in a CSV file. This file will be in the pages directory as configured in your variables.config file.

The second parameter identifies the CSV file itself.  Don't forget to include the .CSV extension.  This file will be in the data directory as configured in your variables.config file.

Examples:

AddPage , pageFileName , datafilename.csv

The Format of the pagefile

The page file need only contain one line of text.

The text line has the following words, each one separated by a comma.

  • RowLabel
  • Text
  • Numeric
  • Ignore

There is one for each column in the incoming CSV file, separated by a comma.  In front of this, there is a hintColumnRole= prefix.

This is best explained by an example.  For a five column CSV file, it would look like:

hintColumnRole=Rowlabel,text,text,numeric,numeric

This example would apply to a CSV data file that had five columns, where the first column is text and would be used on script functions which operate on rowlabels. The next two columns are text columns. The final two columns are numeric. This should match the number of columns in the CSV file.

Notes:

The page file can also have some other optional lines. They are in the software to handle unusual input files. We won't document them here, but if you have unusual needs relating to input files, we might tell you to put a command in this file.

 

 
< Prev   Next >

Reference