Differences
This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
72:custom_reports_accessing_data_reading_plaintext [2019/02/27 18:26] – created ext-bkkr | 72:custom_reports_accessing_data_reading_plaintext [2019/02/27 19:38] – ext-bkkr | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Reading Plain Text Files ====== | ====== Reading Plain Text Files ====== | ||
+ | |||
+ | This example shows how to read data out of a CSV file which is controlled by Stages through a configuration management system. | ||
+ | |||
+ | 1. Create a Report with a Stages Data Source and a Data Set | ||
+ | |||
+ | 2. Create the following Data Set result columns: | ||
+ | |||
+ | ^Name^Type| | ||
+ | |Name|String| | ||
+ | |Value|String| | ||
+ | |||
+ | 3. Copy the Data Set script from the example into your Data Set. | ||
+ | |||
+ | < | ||
+ | String.prototype.splitCSV = function(sep) { | ||
+ | var regex = / | ||
+ | | ||
+ | } | ||
+ | var artifacts = | ||
+ | | ||
+ | | ||
+ | for each (artifact in artifacts) { | ||
+ | if (artifact.getProperty(" | ||
+ | var artifacts_instances = | ||
+ | | ||
+ | for each (artifacts_instance in artifacts_instances) { | ||
+ | if (artifacts_instance.getProperty(" | ||
+ | " | ||
+ | is = artifacts_instance.getProperty(" | ||
+ | dis = new BufferedReader(new InputStreamReader(is)); | ||
+ | | ||
+ | var results = rline.splitCSV(); | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | \\ | ||