netDataTable

Overview

netDataTable is a Dyalog namespace of methods with the basic functions to create, modify and store such DataTable. A .Net DataTable is used to store tabular data in memory. Each column must be of the same type (all characters, all numbers, etc.). The DataTable is an important tool to share large quantity of APL data with .Net controls like a Grid, Chart or a ListView.

To Create a DataTable

      dt  ← AplToDT apl  ⍝ returns a DataTable from Apl data
      apl ← DTtoApl dt   ⍝ returns the Apl data from a DataTable
            ShowDT  dt   ⍝ show the DataTable in a Syncfusion DataGrid

To Modify a DataTable

             dt AddRow apl          ⍝ Add a Row at the end of a DataTable
             dt GetCol colNumber    ⍝ Get the value of a single column of a DataTable
                GetColumnNames dt   ⍝ Get the names of all the columns
             dt GetRow rowNumber    ⍝ Get the value of a row of an existing DataTable
 (dt rowNumber) InsertRow apl       ⍝ Insert a new Row in a DataTable
 (dt rowNumber) SetRow apl          ⍝ Update a row of a DataTable with new values.

To Save a DataTable

     xmlDoc ← DTtoXml dt            ⍝ Xml representation of a Data Table
         dt ← XmlToDT xmlDoc        ⍝ DataTable from an XmlDoc made with DTtoXml

           dt DTtoXmlFile fileName  ⍝ Saves an Xml representation of the DataTable to a file name
         dt ← XmlFileToDT fileName  ⍝ Retrieves a DataTable from an Xml representation made by DTtoXmlFile

           dt DTtoBinFile fileName  ⍝ Saves a Binary representation of the DataTable to a file name
         dt ← BinFileToDT fileName  ⍝ Retrieves a DataTable from a Binary representation made by DTtoBinFile

The namespace ../sfExcel could be used also to save, modify and retrieve a DataTable.

How to install netDataTable in your workspace

  1. Download netDataTable.v1.0.txt

  2. Do a Select all (Ctrl+A) and a copy (Ctrl+C).
  3. In your workspace execute )ed ⍟ netDataTable

  4. Paste (Ctrl+V) the text into the Dyalog editor
  5. Press Escape and ')save' your workspace

Version Information

Original author:

Pierre Gilbert

Responsible:

PierreGilbert

Email:

<apgil AT SPAMFREE videotron DOT ca>

CategoryDyalogDotNetUtilities