The Data Exchange API¶
The following functions you can use within your model, are exposed by the Data Exchange library.
mappingFileto create a mapping called
mappingName – the name of the mapping to be created
mappingFile – the relative path to the mapping file to be parsed.
dex::ReadFromFile(dataFile, mappingName, emptyIdentifiers, emptySets, resetCounters)¶
Reads data from file
dataFileinto model identifiers using mapping
mappingName. Note that the identifiers used in the
write-filterwill not be emptied, regardless of the
emptyIdentifiersargument. When the mapping contains an the
iterative-existingattributes, emptying sets is likely to cause problems, unless the domain sets referred in these attributes are defined.
dataFile – the relative path to the data file to be read
mappingName – the name of the mapping to be used
emptyIdentifiers – indicates whether all identifiers referred in the mapping should be emptied prior to reading the file
emptySets – indicates whether all domain and range sets referred in the mapping should be emptied prior to reading the file
resetCounters – indicates whether to reset all counters for
iterative-binds-toindices prior to reading the file
dex::WriteToFile(dataFile, mappingName, pretty)¶
dataFilefrom data in model identifiers using mapping
dataFile – the relative path to the data file to write to
mappingName – the name of the mapping to be used for writing
pretty – indicates whether to use a pretty writer (enhances readibility at the cost of bigger file size)
Read all mappings contained in the folder
Mappingsand store all successfully read mappings in the set
dex::ColumnNameannotations specified in the model, and use these annotations to fill the identifiers
When every table can needs to be included in just a single dataset, you can uniquely specify the dataset-table mapping using annotations only. If tables need to be included in multiple datasets, you can manually modify the identifier
dex::DatasetTableMappingto add any table to the datasets you wish to include them in.
Generate standardized table and Excel sheet mappings based on the
dex::ColumnNameannotations. The generated mappings will be stored in the
Mappings/Generatedsubfolder of the project folder. All generated mappings will automatically be added to the set of available mappings, and can be directly used to read and write the standardized JSON, XML, CSV or Excel data sources based on the data exchange annotations.
You can influence how mappings will be generated through:
dex::DatasetDenseMappings: when a row will be written, determines wither all columns in that row will be written (default), or only the columns containing a non-default value
dex::DatasetXMLAttributeMappings: determines whether the generated XML format will write all values as XML attribute values (default) or as element values. Indices will always be written as XML attributes.