Class DatasetUtilities
java.lang.Object
com.inductiveautomation.ignition.common.script.builtin.DatasetUtilities
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Dataset
addColumn
(Dataset ds, int colId, org.python.core.PySequence col, String colName, org.python.core.PyType colType) static Dataset
addColumn
(Dataset ds, org.python.core.PySequence col, String colName, org.python.core.PyType colType) static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
appendDataset
(Dataset ds1, Dataset ds2) static Dataset
clearDataset
(Dataset ds) static String
dataSetToCSV
(boolean headerRow, Dataset ds) Deprecated.static String
dataSetToExcel
(boolean headerRow, Object[] datasets) static String
dataSetToExcel
(boolean headerRow, Object[] datasets, boolean nullsEmpty) Deprecated.static byte[]
dataSetToExcelBytes
(boolean headerRow, Object[] objects, boolean nullsEmpty, String[] sheetNames) static void
dataSetToExcelStreaming
(boolean headerRow, Object[] objects, OutputStream out, boolean nullsEmpty) static void
dataSetToExcelStreaming
(boolean headerRow, Object[] datasets, Writer out, boolean nullsEmpty) Deprecated.static String
dataSetToHTML
(boolean headerRow, Dataset ds, String title) static void
dataSetToHTMLStreaming
(boolean headerRow, Dataset ds, String title, Writer fw) static Dataset
static Dataset
deleteRows
(Dataset ds, int[] rows) static Dataset
filterColumns
(Dataset dataset, org.python.core.PySequence columns) static Dataset
formatDates
(Dataset dataset, String format) static Dataset
formatDates
(Dataset dataset, String format, Locale locale) Returns a new dataset with all date columns changed to Strings, and the dates formatted as stringsstatic Dataset
static Dataset
fromCSVJava
(String csv) A special version of fromCSV that throws Java exceptions rather than wrapped, uncaught python exceptionsstatic org.python.core.PyList
static Dataset
insertColumn
(Dataset ds, int colId, Object[] col, String colName, Class colType) static Dataset
insertColumn
(Dataset ds, int colId, org.python.core.PySequence col, String colName, org.python.core.PyType colType) static Dataset
insertColumn
(Dataset ds, org.python.core.PySequence row, String colName, org.python.core.PyType colType) static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
static Dataset
static String
static String
static String
static void
toCSVJavaStreaming
(Dataset ds, Boolean showHeaders, boolean forExport, Writer sw, boolean localized) static Dataset
static Dataset
toDataSet
(org.python.core.PySequence headers, org.python.core.PySequence pyData) static byte[]
Exports 1 or moreDataset
s to excel.static JSONObject
toJSONObject
(Dataset data) Returns a JSON object in the format of:static DatasetUtilities.PyDataSet
toPyDataSet
(Dataset dataset) static Dataset
-
Constructor Details
-
DatasetUtilities
public DatasetUtilities()
-
-
Method Details
-
sort
-
sort
-
sort
-
sort
-
sort
-
sort
-
formatDates
- Throws:
IllegalArgumentException
-
formatDates
public static Dataset formatDates(Dataset dataset, String format, Locale locale) throws IllegalArgumentException Returns a new dataset with all date columns changed to Strings, and the dates formatted as strings- Parameters:
dataset
- Dataset to formatformat
- Date format to uselocale
- Locale to use. If null, default will be used.- Returns:
- New dataset, formatted. If there are no date columns, original dataset is returned.
- Throws:
IllegalArgumentException
- is date format is not valid
-
toPyDataSet
-
toDataSet
-
toDataSet
public static Dataset toDataSet(org.python.core.PySequence headers, org.python.core.PySequence pyData) -
filterColumns
public static Dataset filterColumns(Dataset dataset, org.python.core.PySequence columns) throws Exception - Throws:
Exception
-
fromCSV
-
fromCSVJava
public static Dataset fromCSVJava(String csv) throws IOException, ClassNotFoundException, IllegalArgumentException A special version of fromCSV that throws Java exceptions rather than wrapped, uncaught python exceptions -
toCSV
-
toCSVJava
-
toCSVJava
-
toCSVJavaStreaming
-
toJSONObject
Returns a JSON object in the format of:{ "columns": [ { "name": "col_1", "type": "java.lang.Integer" }, { "name": "col_2", "type": "java.lang.Integer" }, { "name": "col_3", "type": "java.lang.Integer" }], "rows": [ [ 1, 2, "hello" ], [ 3, 8, "whatever" ]] }
-
dataSetToCSV
Deprecated. -
dataSetToHTML
-
dataSetToHTMLStreaming
public static void dataSetToHTMLStreaming(boolean headerRow, Dataset ds, String title, Writer fw) throws IOException - Throws:
IOException
-
dataSetToExcel
@Deprecated public static String dataSetToExcel(boolean headerRow, Object[] datasets, boolean nullsEmpty) Deprecated.Exports 1 or more datasets to excel.- Parameters:
datasets
- An array of Datasets or PyDataSets. Each dataset will be on a separate sheet.
-
dataSetToExcel
-
toExcel
public static byte[] toExcel(org.python.core.PyObject[] pyArgs, String[] keywords) throws IOException Exports 1 or moreDataset
s to excel.- Throws:
IOException
-
dataSetToExcelStreaming
@Deprecated public static void dataSetToExcelStreaming(boolean headerRow, Object[] datasets, Writer out, boolean nullsEmpty) throws IOException Deprecated.- Throws:
IOException
-
dataSetToExcelStreaming
public static void dataSetToExcelStreaming(boolean headerRow, Object[] objects, OutputStream out, boolean nullsEmpty) -
dataSetToExcelBytes
-
addRow
public static Dataset addRow(Dataset ds, org.python.core.PySequence row) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
addRow
public static Dataset addRow(Dataset ds, int rowId, org.python.core.PySequence row) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
insertRow
public static Dataset insertRow(Dataset ds, org.python.core.PySequence row) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
insertRow
public static Dataset insertRow(Dataset ds, int rowId, org.python.core.PySequence row) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
addRows
public static Dataset addRows(Dataset ds, org.python.core.PySequence[] rows) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
addRows
public static Dataset addRows(Dataset ds, int rowId, org.python.core.PySequence[] rows) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
appendDataset
- Throws:
org.python.core.PyException
-
clearDataset
-
addColumn
public static Dataset addColumn(Dataset ds, org.python.core.PySequence col, String colName, org.python.core.PyType colType) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
addColumn
public static Dataset addColumn(Dataset ds, int colId, org.python.core.PySequence col, String colName, org.python.core.PyType colType) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
insertColumn
public static Dataset insertColumn(Dataset ds, org.python.core.PySequence row, String colName, org.python.core.PyType colType) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
insertColumn
public static Dataset insertColumn(Dataset ds, int colId, org.python.core.PySequence col, String colName, org.python.core.PyType colType) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
insertColumn
public static Dataset insertColumn(Dataset ds, int colId, Object[] col, String colName, Class colType) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
getColumnHeaders
public static org.python.core.PyList getColumnHeaders(Dataset ds) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
removeRow
- Throws:
org.python.core.PyException
-
deleteRow
- Throws:
org.python.core.PyException
-
deleteRows
- Throws:
org.python.core.PyException
-
updateRow
public static Dataset updateRow(Dataset ds, int row, org.python.core.PyDictionary changes) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
setValue
public static Dataset setValue(Dataset ds, int row, String col, org.python.core.PyObject value) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
setValue
public static Dataset setValue(Dataset ds, int row, int col, org.python.core.PyObject value) throws org.python.core.PyException - Throws:
org.python.core.PyException
-
setValue
public static Dataset setValue(Dataset ds, int row, int col, Object value) throws org.python.core.PyException - Throws:
org.python.core.PyException
-