public class DataImportRequest
extends java.lang.Object
Example call from Groovy to import data from a CSV file:
Cube cube = operation.application.getCube("Plan1") cube.createDataImportRequest().importDataFromFile("Level0DataWithDimHeader.csv", COLUMN_FORMAT_WITH_DIM_HEADERS, ',')
Example call from Groovy to import data from a zip file:
Cube cube = operation.application.getCube("Plan1") cube.createDataImportRequest().importDataFromZipFile("Level0ZippedDataWithDimHeader.zip, COLUMN_FORMAT_WITH_DIM_HEADERS, ',')
Example call from Groovy to import data to an ASO cube from a CSV file using a specific date format, delimiter and other data load options:
Cube cube = operation.application.getCube("HP1_ASO") cube.createDataImportRequest() .setDateFormat("dd/MM/yyyy") .setDataLoadOption(ADD_TO_EXISTING_VALUE) .setAsoDataValueOption(IGNORE_MISSING_VALUES) .setAsoDuplicateAggregationMethod(USE_LAST) .setErrorFileName("Level0DataWithDimHeaderErrors.log") .importDataFromFile("HP1-Level0DataWithDimHeader.csv", COLUMN_FORMAT_WITH_DIM_HEADERS, '|')
Example call from Groovy to iterate over exported data rows, calculate other data based on the current row data and import the calculated data back to the cube. In this example, Max Bonus is calculated based on the exported Min Salary and the calculated bonus data is imported back to the cube using the DataImporter:
Cube cube = operation.application.getCube("Plan1") List<Member> periods = operation.application.getDimension("Period").getEvaluatedMembers("ILvl0Descendants(YearTotal)", cube) cube.createDataExporter().setColumnMemberNames(periods).setRowFilterCriteria("EUR", "FY19", "Min Salary", "Current").exportData().withCloseable { exportIterator -> cube.createDataImportRequest().importData(periods).withCloseable { dataImporter -> exportIterator.each { Map<String, String> maxBonuses = it.valuesMap.collectEntries { k, v -> [(k): (v && v != "#Mi" ? (Double.parseDouble(v) * 0.1) as String : v)] } as Map<String, String> dataImporter.addRow(createRowData(it.rowTuple + ["Account" : "Max Bonus"], it.columnMembers, maxBonuses)) } } }
Modifier and Type | Method and Description |
---|---|
DataImportAsoDataValueOption |
getAsoDataValueOption()
Returns the data value option.
|
DataImportAsoDuplicateAggregationMethod |
getAsoDuplicateAggregationMethod()
Returns the duplicate aggregation method.
|
DataImportDataLoadOption |
getDataLoadOption()
Returns the data load option.
|
java.lang.String |
getDateFormat()
Returns the date format.
|
java.lang.String |
getErrorFileName()
Returns the error file name.
|
DataImporter |
importData(java.util.List<?> colSelectionRefs)
Returns a DataImporter created with the specified parameters.
|
void |
importDataFromFile(java.lang.String fileName,
DataFileFormat fileFormat,
char delimiter)
Imports data from a file with the spcified name from the Inbox.
|
void |
importDataFromFile(java.lang.String fileName,
DataFileFormat fileFormat,
java.lang.CharSequence delimiter)
Imports data from a file with the spcified name from the Inbox.
|
void |
importDataFromZipFile(java.lang.String zipFileName,
DataFileFormat fileFormat,
char delimiter)
Imports data from all the files archived inside the zip file with the
spcified name from the Inbox.
|
void |
importDataFromZipFile(java.lang.String zipFileName,
DataFileFormat fileFormat,
java.lang.CharSequence delimiter)
Imports data from all the files archived inside the zip file with the
spcified name from the Inbox.
|
DataImportRequest |
setAsoDataValueOption(DataImportAsoDataValueOption asoDataValueOption)
Returns this object after setting the data value option.
|
DataImportRequest |
setAsoDuplicateAggregationMethod(DataImportAsoDuplicateAggregationMethod asoDuplicateAggregationMethod)
Returns this object after setting the duplicate aggregation method.
|
DataImportRequest |
setDataLoadOption(DataImportDataLoadOption dataLoadOption)
Returns this object after setting the data load option.
|
DataImportRequest |
setDateFormat(java.lang.String dateFormat)
Returns this object after setting the date format.
|
DataImportRequest |
setErrorFileName(java.lang.String errorFileName)
Returns this object after setting the error file name.
|
public DataImportAsoDataValueOption getAsoDataValueOption()
public DataImportAsoDuplicateAggregationMethod getAsoDuplicateAggregationMethod()
public DataImportDataLoadOption getDataLoadOption()
public java.lang.String getDateFormat()
public java.lang.String getErrorFileName()
public DataImporter importData(java.util.List<?> colSelectionRefs) throws java.lang.Exception
A colSelectionRefs can be an object representing references to a column member (see section Member References)
Any columns that are not present in both the file and the subset are not processed.
The job status will indicate the number of rows skipped due to a variety of reasons.
This is a privileged method, see section Privileged Method
colSelectionRefs
- the subset of columns in the input data that
should be processedjava.lang.Exception
- if the import cannot be started or completedpublic void importDataFromFile(java.lang.String fileName, DataFileFormat fileFormat, char delimiter) throws java.lang.Exception
Only simple file names should be provided. File names with paths or relative paths will be rejected.
The job status will indicate the number of rows skipped due to a variety of reasons.
This is a privileged method, see section Privileged Method
fileName
- data file namefileFormat
- format of the date filedelimiter
- delimiter used in the data filejava.lang.Exception
- if the file is not found, the file name is not a
simple name or the import cannot be started or completed.public void importDataFromFile(java.lang.String fileName, DataFileFormat fileFormat, java.lang.CharSequence delimiter) throws java.lang.Exception
Only simple file names should be provided. File names with paths or relative paths will be rejected.
The job status will indicate the number of rows skipped due to a variety of reasons.
This is a privileged method, see section Privileged Method
fileName
- data file namefileFormat
- format of the date filedelimiter
- delimiter used in the data filejava.lang.Exception
- if the file is not found, the file name is not a
simple name or the import cannot be started or completed.public void importDataFromZipFile(java.lang.String zipFileName, DataFileFormat fileFormat, char delimiter) throws java.lang.Exception
Only simple file names should be provided. File names with paths or relative paths will be rejected.
There will be a job created for each of the files being imported as a child job of the zip file import job. The job status will indicate the number of rows skipped due to a variety of reasons.
All data files in the zip file are expected to be in the format specified here. Data from files whose formats do not match the format specified here will be rejected and the failure reason will be indicated in the job status for that file.
This is a privileged method, see section Privileged Method
zipFileName
- zip data file namefileFormat
- format of the date filedelimiter
- delimiter used in the data filejava.lang.Exception
- if the file is not found, the file name is not a
simple name or the import cannot be started or completed.public void importDataFromZipFile(java.lang.String zipFileName, DataFileFormat fileFormat, java.lang.CharSequence delimiter) throws java.lang.Exception
Only simple file names should be provided. File names with paths or relative paths will be rejected.
There will be a job created for each of the files being imported as a child job of the zip file import job. The job status will indicate the number of rows skipped due to a variety of reasons.
All data files in the zip file are expected to be in the format specified here. Data from files whose formats do not match the format specified here will be rejected and the failure reason will be indicated in the job status for that file.
This is a privileged method, see section Privileged Method
zipFileName
- zip data file namefileFormat
- format of the date filedelimiter
- delimiter used in the data filejava.lang.Exception
- if the file is not found, the file name is not a
simple name or the import cannot be started or completed.public DataImportRequest setAsoDataValueOption(DataImportAsoDataValueOption asoDataValueOption)
This option is honored only when importing data to an ASO cube.
asoDataValueOption
- data value optionpublic DataImportRequest setAsoDuplicateAggregationMethod(DataImportAsoDuplicateAggregationMethod asoDuplicateAggregationMethod)
This option is honored only when importing data to an ASO cube.
asoDuplicateAggregationMethod
- duplicate aggregation methodpublic DataImportRequest setDataLoadOption(DataImportDataLoadOption dataLoadOption)
dataLoadOption
- data load optionpublic DataImportRequest setDateFormat(java.lang.String dateFormat)
Following are examples of supported date formats:
Date | Format |
---|---|
10/21/2018 | MM/dd/yyyy |
10/21/2018 | MM-dd-yyyy |
21/10/2018 | dd/MM/yyyy |
21-10-2018 | dd-MM-yyyy |
2018/10/21 | yyyy/MM/dd |
2018-10-21 | yyyy-MM-dd |
dateFormat
- the format of the dates in the source datapublic DataImportRequest setErrorFileName(java.lang.String errorFileName)
A file with the specified name will be generated and uploaded to the outbox with errors that occur when processing rows in the source data.
errorFileName
- error file nameCopyright © 2017, 2024, Oracle and/or its affiliates. All rights reserved.