Using The CsvMapper
CSV Mapper Component
The CsvMapper component can be found in the Niagara palette under the "alxCsvMapper" name. The object can be dropped directly into the Niagara Station for setup.
CSVMapper Location
The component must be dropped within a Niagara Folder in the station, NOT the File Space within the station
Example Configuration
The following screenshots show the sequence from configuring the CsvMapper to the resulting histories in AX.
Object Properties
- Status - Displays the status of the CsvMapper, "{ok}" means working correctly.
- Fault Cause - If the Status of the object is "{fault}", this property will explain what error occured.
- Csv File - This property points to the CSV file that will be imported.
- Execution Time - This property determines how often the CsvMapper will "reload" the CSV file. It can be set to manually update (only user can force an update), or to update periodically on any time frame.
- Timestamp Format - This is the format of the Timestamp column of the CSV file. The format is the standard 'Simple Date Format', full documentation below. Note that if no time is provided, 12:00 AM will be used.
- Example Timestamp - This property changes everytime the Timestamp Format string is modified to show an example timestamp.
- Timestamp Column Index - This property points to the column index of the timestamp in the CSV file (forced to 1).
- Device Row Index - Often when importing CSV files, there is a need to name the "Device" of each history. This can be cumbersome when using other methods (like the File Driver) due to manually having to set each histories device name. This property tells us which row of the CSV file will be used for naming the "Device" of your history.
- Static Device Name - If any text is entered in this property, Device Row Index will be ignored and all histories will be given this device name.
- History Name Row Index - Similar to the Device Row Index, this property tells us which row to use for naming the histories.
- Skip Rows - This property tells us how many rows to skip (or in other words, how many rows from the top before actual data exists).
- History Type - Either "Numeric Trend" or "Utility Bill Trend"; a numeric trend is used for the example configuration below.
- Numeric Trend - indicates that the CSV being mapped contains a single timestamp/value pair for each historical entry.
- Utility Bill Trend - indicates that the CSV being mapped has 2 timestamps indicating a start date and end date for the billing period for a bill as well as 3 value columns per each history for cost, consumption, and demand. An example of what the CSV for this would look like is provided below.
- Points - This folder is created anytime a CSV is imported in order to provide a connected Numeric point for each history that is generated. The points can then be tagged and related to necessary objects in the station to allow for usage in Periscope or other context-sensitive programs in Niagara.
Example Numeric Trend History Type CSV:
Example Utility Bill Trend History Type CSV:
Please note, this example is purely to illustrate how the values are represented in the CSV. In this example, we can say that the columns with values of 500, 1000, 1500 are our cost, consumption and demand columns for "Bill_1". Units for these values are assigned through the dashboard's trend configuration.
Example of Histories Created via CSV Mapping:
In the event of using a "Utility Bill Trend" only one history is created for the utility bill, saving space as well as helping your organizational file structure.
Note that the Device Row Index is "1", meaning each history will use the Device name of "Charlotte". Also, each history name is grabbed from the 2nd row and the data starts on row 3.
Timestamp Format
Letter | Date or Time | Presentation | Examples |
| Era designator |
| |
| Year |
| |
| Month in year |
| |
| Week in year |
| |
| Week in month |
| |
| Day in year |
| |
| Day in month |
| |
| Day of week in month |
| |
| Day in week |
| |
| Am/pm marker |
| |
| Hour in day (0-23) |
| |
| Hour in day (1-24) |
| |
| Hour in am/pm (0-11) |
| |
| Hour in am/pm (1-12) |
| |
| Minute in hour |
| |
| Second in minute |
| |
| Millisecond |
| |
| Time zone |
| |
| Time zone |
|