DOCUMENTATION

  • AIMMS optimization tooling introduction
    • AIMMS Developer & Deployment Platform
    • Comparison with other tools
    • Technical Specifications
    • Solvers
      • Solvers availability
      • Advanced Algorithms for Mathematical Programs
      • AIMMS Outer Approximation (AOA)
      • BARON
      • CBC
      • CONOPT
      • COPT
      • CP Optimizer
      • CPLEX
      • Gurobi
      • IPOPT
      • Knitro
      • MINOS
      • Octeract
      • ODH-CPLEX
      • PATH
      • SNOPT
    • Mathematical Programming
      • Mathematical Programming
      • Linear Programming
      • Mixed Integer Programming
      • Nonlinear Programming
      • Mixed Integer Nonlinear Programming
      • Constraint Programming
      • Other Mathematical Programming Types
  • Function Reference
  • User's Guide
  • Language Reference
  • Modeling Guide
  • webui
  • PRO Platform
    • Introduction to the AIMMS PRO Platform
    • Installation
      • System Requirements
      • Installation and Configuration of the License Server
      • General Architecture
      • Installation of AIMMS PRO on Windows
    • The AIMMS PRO Configurator
      • Configuring the configurator
      • Various sections of the configurator
      • Setting up an AIMMS PRO Cluster
      • Server-side Logging
    • Server Administration
      • AIMMS Application Management
      • AIMMS Version Management
      • User Management
      • Monitoring
      • Configuration
        • AD Settings
        • Retention Settings
        • Portal Customization
        • Tunnels
        • Queue Priorities
        • Log Management
        • Active Data Sessions
        • Seats Management
      • Linking Environments to Active Directory Domains
        • Link to Active Directory for AD Member Servers
        • Link to Active Directory for Non-AD Member Servers
      • SAML Support
      • Tunneling support
      • Commonly Encountered Errors
      • Miscellaneous
    • AIMMS PRO End-User Portal
    • MFA for AIMMS PRO Portal
    • Project Setup
      • Adding PRO Libraries to your Project
      • Basic AIMMS PRO Workflow
      • Conversion Guidelines
      • AIMMS PRO and Data Management
      • Advanced AIMMS PRO Workflows
        • Determining the Application State to Transfer
        • Advanced Usage of pro::DelegateToServer
        • Communication Between client-side and Server-side Sessions
        • Using Messages in Your PRO Applications
        • The PRO Progress Window
        • Using Solver leases instead of DelegateToServer
      • Debugging PRO-enabled Projects
    • AIMMS PRO Java/C# API
  • Cloud Platform
    • Introduction to AIMMS Cloud Platform
    • General Architecture
    • System Requirements
    • Server Administration
      • AIMMS Application Management
      • Activate AIMMS Version
      • User Management
      • Configuration
        • AD Settings
        • Retention Settings
        • Portal Customization
        • Tunnels
        • Queue Priorities
        • AIMMS Cloud Database and VPN Configuration
        • Active Data Sessions
        • Seats Management
      • Linking Environments to Active Directory Domains
        • Link to Active Directory for AD Member Servers
        • Link to Active Directory for Non-AD Member Servers
      • SAML Support
      • Tunneling support
      • Commonly Encountered Errors
      • Miscellaneous
    • AIMMS PRO End-User Portal
    • MFA for AIMMS PRO Portal
    • Project Setup
      • Adding PRO Libraries to your Project
      • Basic AIMMS PRO Workflow
      • Conversion Guidelines
      • AIMMS PRO and Data Management
      • Advanced AIMMS PRO Workflows
        • Determining the Application State to Transfer
        • Advanced Usage of pro::DelegateToServer
        • Communication Between client-side and Server-side Sessions
        • Using Messages in Your PRO Applications
        • The PRO Progress Window
        • Using Solver leases instead of DelegateToServer
      • Debugging PRO-enabled Projects
    • Gurobi Support on AIMMS Cloud Platform
    • Getting the latest AIMMS Releases on AIMMS Cloud Platform
    • AIMMS PRO REST API
    • Launching Python, R and other services
    • Running Tasks
    • Privacy Statement
    • Managing Sessions
  • Data integration with AIMMS
  • Library Repository
    • Getting Started with AIMMS Library Repositories
    • AIMMSXL Library
      • Using the AIMMSXL Library
      • Example
      • AIMMSXL Documentation
      • AIMMSXL Library Release Notes
    • CDM Library
      • Introduction
      • Installing AIMMS CDM
      • Configuring your model for CDM
      • Dealing with external and derived data
      • Day-to-day CDM operations
      • Callbacks and hooks provided by CDM
      • CDM Authentication and Authorization
      • CDM implementation details
      • Low-level CDM API
      • CDM Library Release Notes
    • Data Exchange Library
      • Using the Data Exchange library for communicating data
      • Data Exchange Mappings
      • Standard Data Exchange formats
      • Application Database
      • Consuming REST APIs
      • Generating API client code from an OpenAPI specification
      • Providing REST APIs
      • Azure Data Lake Storage
      • Data warehouses
      • Methods provided by the Data Exchange library
      • DEX Troubleshooting
      • DataExchange Library Release Notes
    • DataLink Library
      • What is DataLink?
      • The Data Map
      • Read and Write
      • Source Information
      • Data Map Automation
      • Tips and Tricks
      • Providers
      • Examples
      • DataLink Library Release Notes
    • Email Client Library
      • Introduction
      • Email Client API
      • EmailClient Library Release Notes
    • Forecasting Library
      • Introduction
      • Notational Conventions
        • Simple Linear Regression
        • Time Series Forecasting
      • Functions
        • forecasting::ExponentialSmoothing
        • forecasting::ExponentialSmoothingTune
        • forecasting::ExponentialSmoothingTrend
        • forecasting::ExponentialSmoothingTrendTune
        • forecasting::ExponentialSmoothingTrendSeasonality
        • forecasting::ExponentialSmoothingTrendSeasonalityTune
        • forecasting::MovingAverage
        • forecasting::WeightedMovingAverage
        • forecasting::SimpleLinearRegression
    • GuardServerSession Library
      • Introduction
      • Error and Profiling Results as Data
      • The GSS End User interface for end-users
      • The GSS User Interface for specialists
      • The action log
      • Investigate state solver session
      • Integrate GuardServerSession library with your AIMMS Application
      • Install GSS interface for end-users
      • Install UI of GuardServerSession Library
      • Install UI Request manager
      • Install UI Inspect Running Solver Sessions
      • GuardServerSession Library Release Notes
    • HTTP Client Library
      • Introduction
      • What is HTTP?
      • Using the HTTP Client
      • HTTP Client API
      • HTTPClient Library Release Notes
    • RLink Library
      • Setting up RLink
      • Using RLink
      • Iris Example
      • RLink Library Release Notes
    • Snowflake Library
      • Introduction
      • Snowflake API
      • Snowflake Library Release Notes
    • Unit Test Library
      • Creating unit test suites
      • Running test suites
      • Automated testing
      • AIMMSUnitTest Library Release Notes
      • New Features and Bug Fixes
  • Aimms Network License Server
    • Introduction
    • Linux Setup
    • AIMMS Network License Server Release Notes
  • AIMMS Information Security
  • AIMMS Release Notes
  • AIMMS PRO Release Notes
  • AIMMS Product Lifecycle
AIMMS Documentation
AIMMS Logo
  • Documentation »
  • DataLink configuration
  • Edit on Github
Help & feedback

Table Of Contents
  • DataLink configuration
    • Installation and setup
    • Read and Write Attributes
    • The mapping

DataLink configuration

Installation and setup

To use DataLink only two things are needed:

  • The DataLink library should be added to the project.

  • A provider library should be added to the project.

The libraries are made available in through the AIMMS library repository, and can be installed from the AIMMS Library Manager.

The use of DataLink always takes two steps:

  • Step 1 is the configuration. The provider has to be specified and also the mapping of identifiers to column names has to be specified. Optionally extra column and table attributes can be set depending of the kind of provider.

  • Step 2 is the call to DataRead or DataWrite. This is when the data is transferred between AIMMS and the data source.

All providers have a string identifier called DataLink containing the location of the binary file (the code) that has to run to transfer the data. All we have to do to specify a provider is to pass this string as attribute ‘Provider’ to DataLink. DataLink then can call this code to do the actual reading and writing.

Read and Write Attributes

Suppose the XLSProvider is used. It has a library prefix xlsprov and so we can do:

SP_ReadWriteAttributes(dl::rwattr) :={ 'DataProvider' : xlsprov::DataLink , ... }
dl::DataRead("MyExcelFile.xlsx", "TheMapping" , ReadWriteAttributes);

In this code example,

  • SP_ReadWriteAttributes is a string parameter indexed over the DataLink Library dl::rwattr, where you will specify (among others) the provider,

  • "TheMapping" is the name of the mapping which we still have to specify,

  • "MyExcelFile.xlsx" is the name of the data source.

Note

To write in the Excel file, you may use the function dl::DataWrite, using same arguments than dl::DataRead.

There are other elements than 'DataProvider' in dl::rwattr, but their use depends on the kind of provider:

  • 'EmptyData': If 1 or "yes" then the data will be cleared after writing.

  • 'OverWrite': If 1 or "yes" the data in the data source will be cleared before writing.

  • 'MissingValue': What to do when the reader encounters a missing or unreadable value in the data source. If "error" an error is reported and the running function stops. If "ignore" nothing happens. The default value is "warn", a message is send to the message window, but the function keeps running.

  • 'Separator': This is needed by the CSVProvider to turn lines in the CSV file into columns. The default value is ",".

The mapping

Mappings can be added and removed from DataLink using their names.

dl::AddDataSourceMapping("TheMapping", DataMap, ...);

"TheMapping" string is the name of the mapping. It will persist until it is removed from DataLink by doing dl::RemoveDataSourceMapping("TheMapping");. The String Parameter DataMap defines the mapping.

A basic data-map looks like this:

DataMap(dl::dt,dl::idn,dl::cn,dl::dn) := data {
( TableNameInSource, S_TheSet        , 1, 1 ) : "ColumnNameInSource",
( TableNameInSource, P_TheParameter  , 2, 0 ) : "OtherColumnNameInSource",
};

We tried to make names as explicit as possible. S_TheSet is a Set identifier in AIMMS, and P_TheParameter is a Parameter indexed over S_TheSet. The numbers 1 and 2 are column numbers. For each table they start at 1 and are counted up, starting with all the domains (sets) first, followed by all the parameters. The numbers 1 and 0 are the domain numbers. If the domain number equals the column number it is a set that can serve as a domain. If the domain number is zero then it is a parameter that has all the sets in the table as domain.

In this example the source only has one table named TableNameInSource but more tables can be specified if they are present in the data source. A table TableNameInSource in the source can have as many columns in any order, but in the data-map we say that we are only interested in the two columns with the names specified (ColumnNameInSource and OtherColumnNameInSource). It is up to the provider to figure out which columns are available and how to connect these to the DataLink columns.

One thing to keep in mind is that the data map is just a 4D string parameter in AIMMS. This means that we can only assign the data (:= data) when all elements of the domain set exist. For the column numbers, the domain numbers and the identifier names, it is not a problem. For the table names, the first domain of the data map, DataLink cannot know in advanced what these names should be and starts with an empty set dl::DataTables. We can simply add the name TableNameInSource to this set by doing:

dl::DataTables += {'TableNameInSource'} ;

Function dl::AddDataSourceMapping has three extra arguments to pass extra attributes to the specific providers. Datalink provides empty argument parameters for when no attribute needs to be set. The full call to dl::AddDataSourceMapping with empty attributes becomes:

dl::AddDataSourceMapping("TheMapping",DataMap, dl::DependEmpty, dl::TableAttributesEmpty, dl::ColAttributeEmpty);
Last updated: Dec 31, 2021

Help & Feedback

Docs

Edit this page to fix an error or add an improvement in a pull request
Create an issue to suggest an improvement to this page

Product

Create a topic if there's something you don't like about this feature
Propose functionality by submitting a feature request

Support

Not what you where looking for? Search the docs

Remember we also have Community support

Still having trouble ? Reach out to us



AIMMS
AIMMS COMMUNITY
AIMMS DOCS
DISCLAIMER
PRIVACY STATEMENT
© 1989 - 2025 AIMMS B.V.