Data Sources provide tables of resource data to be used by a form. A complete description of data sources and how they are created through a process called Data Replication is available here. This article focuses on how to create a static data source that originates from a CSV (comma-separated value) file.

Create a CSV file

The first step in creating a CSV data source is creation of the CSV file itself. If this file was provided to you, then verify it matches the format described here. When using a plain text editor, the CSV file should contain a header row with column names followed by the row data itself. Values are of course separated by commas, without any space characters around them.

If Excel is used to create the data, the worksheet should be exported as CSV file type. You may ignore the warning that "Some features in your workbook might be lost if you save it as CSV (comma delimited)."

Create a Data Source

Once the CSV file is created, the next step is to create a data source on the Mi-Enterprise Middleware (MEM) server. Log in as an administrator and select Data -> Data Sources.

There are two objects that must be created: a data source file that represents the source CSV file, and a data source that references this object. From this screen, locate the list of Data Source Files and click on "Upload New Data Source File (.csv)." After choosing your file and clicking "Upload," the new CSV file will appear in the list of Data Source Files and will be available for use.

Now click on "Add New Data Source" to create the new resource. Provide a friendly name for the resource and select "CSV" as the Type. Under the "CSV File Name" dropdown, choose the data source file created above and some entity information will automatically populate.

If desired, change the Entity Name (this will appear in the NGD form designer as the table name for this data source) and the data type for each column. Select one or more columns to be the key values (this is required). Typically, a column containing unique values is selected, such as an index or ID number. Finally, assign permissions to the resource by selecting the appropriate Groups and moving them to the "Allowed" list box.

Press Add to create the data source. The resource is now available to be added to all form templates provided their owner has the appropriate permission. 

To modify the data source, simply click on its name under the data source list to return to the configuration screen. It is assumed that the data contained in the CSV file is relatively static and thus will not change often. However, if it is necessary to modify the data contents you may perform the following:

  • update the local CSV file, or create a new file containing the updated data.
  • update the data source file - from the Data Sources menu click on the data source file, click "Choose File," and then "Upload" to replace the data source file's contents.
  • update the data source - from the Data Sources menu click on the data source, then click "Update Data."

Note that when updating data any new values will be placed at the end of the data source. If the data source is used to populate a dropdown field, for example, then the order that the row values appear in the dropdown may not match the source CSV file if the data source was initially created and then updated with new values. The only way to completely refresh the data source is to delete it and then create it again.