<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=TABLE</id>
	<title>TABLE - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=TABLE"/>
	<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=TABLE&amp;action=history"/>
	<updated>2026-08-04T16:13:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.ice-online.com/index.php?title=TABLE&amp;diff=807&amp;oldid=prev</id>
		<title>ConvertBot: Perform various table related functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=TABLE&amp;diff=807&amp;oldid=prev"/>
		<updated>2020-04-27T22:05:03Z</updated>

		<summary type="html">&lt;p&gt;Perform various table related functions&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Perform various table related functions&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;TAB&amp;gt;  - Table name&lt;br /&gt;
&amp;lt;FUNC&amp;gt; - Function Name (COPY,CREATE,EQUALS,LIST,LOAD,SAVE,...)&lt;br /&gt;
&amp;lt;P3&amp;gt;   - Optional parameter dependent on &amp;lt;FUNC&amp;gt;&lt;br /&gt;
&amp;lt;P4&amp;gt;   - Optional parameter dependent on &amp;lt;FUNC&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TABLE MODES:&lt;br /&gt;
  Each table has a mode. The mode of a table describes the underlying data&lt;br /&gt;
  structure that holds the table's keys and values. Each mode has slightly&lt;br /&gt;
  different behavior, particularly in terms of performance and iteration&lt;br /&gt;
  order.&lt;br /&gt;
&lt;br /&gt;
  Prior to NeXtMidas 2.7.0 there were only three table modes (FB, KV and HT)&lt;br /&gt;
  and the default mode was hard-coded to KV mode. Several additional modes&lt;br /&gt;
  were added in NeXtMidas 2.7.0 as well as the ability to set the default&lt;br /&gt;
  table mode.&lt;br /&gt;
&lt;br /&gt;
  Some of the more common table modes:&lt;br /&gt;
    FB   = FromBytes                 (Internal byte serialization of a table)&lt;br /&gt;
    HT   = HashTable                 (Uses a Java Hashtable)&lt;br /&gt;
    KV   = KeyVector                 (Uses NeXtMidas KeyVector)&lt;br /&gt;
    SLHM = SynchronizedLinkedHashMap (Uses a Java LinkedHashMap)&lt;br /&gt;
    STM  = SynchronizedTreeMap       (Uses a Java TreeMap)&lt;br /&gt;
    CHM  = ConcurrentHashMap         (Uses a Java ConcurrentHashMap) Since 3.1.1&lt;br /&gt;
&lt;br /&gt;
  Details on all of the table modes are included in the documentation for the&lt;br /&gt;
  Table class (see nxm.sys.lib.Table).&lt;br /&gt;
&lt;br /&gt;
FUNCTION: [DEF=LIST]&lt;br /&gt;
  COPY    - Copy a table.  Does not copy any references to other objects&lt;br /&gt;
            or tables, these are copied as strings.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tabin&amp;gt; COPY &amp;lt;tabout&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  CREATE  - Creates a new table. This can (1) create an empty table, (2) create&lt;br /&gt;
            a table from a string, (3) create a table that is a shallow-copy of&lt;br /&gt;
            a Java Hashtable, (4) create a new reference to an existing Table,&lt;br /&gt;
            or (5) load a named .tbl file.&lt;br /&gt;
              SYNTAX:   TABLE &amp;lt;tabout&amp;gt; CREATE               ! (1) empty table&lt;br /&gt;
                     or TABLE &amp;lt;tabout&amp;gt; CREATE {x=1,y=2}     ! (2) from string&lt;br /&gt;
                     or TABLE &amp;lt;tabout&amp;gt; CREATE &amp;lt;hashtable&amp;gt;   ! (3) from Hashtable&lt;br /&gt;
                     or TABLE &amp;lt;tabout&amp;gt; CREATE &amp;lt;table&amp;gt;       ! (4) from Table&lt;br /&gt;
                     or TABLE &amp;lt;tabout&amp;gt; CREATE &amp;lt;tbl_file&amp;gt;    ! (5) from .tbl file&lt;br /&gt;
&lt;br /&gt;
  EQUALS  - Compares two tables to see if they have the same keys and values.&lt;br /&gt;
            The result of the comparison (&amp;quot;TRUE&amp;quot; or &amp;quot;FALSE&amp;quot; is put in &amp;lt;res&amp;gt;).&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;first&amp;gt; EQUALS &amp;lt;second&amp;gt; &amp;lt;res&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            The values are compared using Util.equals(Object,Object) method&lt;br /&gt;
            and does not test for nested tables. Also, this does not consider&lt;br /&gt;
            table order (e.g. {A=1,B=2} and {B=2,A=1} would be equal).&lt;br /&gt;
&lt;br /&gt;
  GETDEFAULTFlags - Get the default table flags and put it in result &amp;lt;res&amp;gt;.&lt;br /&gt;
              SYNTAX: TABLE ,, GETDEFAULTFLAGS &amp;lt;res&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  GETESCAPEDSTRING - Get the Table as a String, with escape sequences inserted&lt;br /&gt;
                     where needed (in place of quotes, tabs, newlines, Unicode&lt;br /&gt;
                     sequences, etc). Since NeXtMidas 2.9.0.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; GETESCAPEDSTRING &amp;lt;res&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  GETDEFAULTMODE - Get the default table mode and put it in result &amp;lt;res&amp;gt;.&lt;br /&gt;
              SYNTAX: TABLE ,, GETDEFAULTMODE &amp;lt;res&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  GETFLAGS - Get the table flags for &amp;lt;tab&amp;gt; and put it in results &amp;lt;res&amp;gt;.&lt;br /&gt;
             Since NeXtMidas 2.9.3.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; GETFLAGS &amp;lt;res&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  GETKEY  - Get value of &amp;lt;key&amp;gt; in Table &amp;lt;tab&amp;gt; and put in it results &amp;lt;res&amp;gt;.&lt;br /&gt;
            Quote the &amp;lt;key&amp;gt; name to retrieve a mixed or all lower case key from&lt;br /&gt;
            the Table. If &amp;lt;res&amp;gt; is not specified, it is displayed to terminal.&lt;br /&gt;
            Since NeXtMidas 2.7.1.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; GETKEY &amp;lt;key&amp;gt; &amp;lt;res&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  GETKEYS - Get all the keys in a table.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; GETKEYS   &amp;lt;res&amp;gt;  ! Get the keys as an array&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; GETKEYS/S &amp;lt;res&amp;gt;  ! Get the keys as a string&lt;br /&gt;
&lt;br /&gt;
            Valid Modifiers:&lt;br /&gt;
              /S - Returns a comma-separated string rather than an array.&lt;br /&gt;
              /R - Reverses the order of the elements returned.&lt;br /&gt;
&lt;br /&gt;
  GETMODE - Get the table mode and put it in result &amp;lt;res&amp;gt;.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; GETMODE &amp;lt;res&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  GETSIZE - Gets the size of the table (i.e. the number of keys in the table).&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; GETSIZE &amp;lt;res&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  LIST    - LIST the contents of a table&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; LIST&lt;br /&gt;
&lt;br /&gt;
  LOAD    - Loads a table from a .tbl file.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tabout&amp;gt; LOAD &amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            Note1: Without the /T or /X the file name MUST end in .tbl or .xml.&lt;br /&gt;
                   This works the same as &amp;quot;results t:&amp;lt;tabout&amp;gt; &amp;lt;filename&amp;gt;&amp;quot;.&lt;br /&gt;
                   (When accessing a URL or a file without an extension the /T&lt;br /&gt;
                   or /X modifier must be used.)&lt;br /&gt;
            Note2: This forces output Table to KeyVector mode to allow&lt;br /&gt;
                   duplicates for legacy/backwards compatibility reasons (by&lt;br /&gt;
                   enabling the &amp;quot;Add&amp;quot; flag, but will only remove that flag on&lt;br /&gt;
                   the main table but not on sub-tables.)&lt;br /&gt;
                   To force using default Table mode and flags output table and&lt;br /&gt;
                   it sub-tables, use LOAD/T along with /FLAGS=default or&lt;br /&gt;
                   /FLAGS=&amp;lt;desired table flags&amp;gt; switch.&lt;br /&gt;
&lt;br /&gt;
            Warning: The OPAL table import feature is still experimental and not&lt;br /&gt;
                     all OPAL table constructs are supported.&lt;br /&gt;
&lt;br /&gt;
            Valid Modifiers:&lt;br /&gt;
              /O - File is an Midas2K OPAL table (note this modifier uses a&lt;br /&gt;
                   capital 'o' not the number zero).     [Since NeXtMidas 3.3.2]&lt;br /&gt;
              /C - Ignore normal NeXtMidas rules and treat OPAL table keys as&lt;br /&gt;
                   case-sensitive (this will make the table difficult to use&lt;br /&gt;
                   within NeXtMidas).                    [Since NeXtMidas 3.3.2]&lt;br /&gt;
              /T - File is a .tbl file even if does not end in .tbl.&lt;br /&gt;
              /X - File is a .xml file even if does not end in .xml.&lt;br /&gt;
&lt;br /&gt;
  LOADCFG - Loads a table from a .cfg configuration file (such as those commonly&lt;br /&gt;
            used on Windows systems and with Python). Since NeXtMidas 3.1.3.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tabout&amp;gt; LOADCFG &amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            This will take a configuration file in the form:&lt;br /&gt;
              [SECTION1]&lt;br /&gt;
              KEY1=VAL1&lt;br /&gt;
              KEY2=VAL2&lt;br /&gt;
              ...&lt;br /&gt;
&lt;br /&gt;
              [SECTION2]&lt;br /&gt;
              KEY1=VAL1&lt;br /&gt;
              KEY2=VAL2&lt;br /&gt;
              ...&lt;br /&gt;
&lt;br /&gt;
            And create a corresponding table of tables in the form:&lt;br /&gt;
             {SECTION1={KEY1=VAL1,KEY2=VAL2,...},&lt;br /&gt;
              SECTION2={KEY1=VAL1,KEY2=VAL2,...},&lt;br /&gt;
              ...}&lt;br /&gt;
&lt;br /&gt;
            Valid Modifiers:&lt;br /&gt;
              /C - Ignore normal rules and treat the keys as case-sensitive&lt;br /&gt;
                   (does not apply to section names).&lt;br /&gt;
              /D - If a default section is found, automatically merge any&lt;br /&gt;
                   default values in with the other section entries.&lt;br /&gt;
&lt;br /&gt;
  MERGE   - Merges &amp;lt;table1&amp;gt; and &amp;lt;table2&amp;gt; by adding or replacing keys in &amp;lt;table1&amp;gt;&lt;br /&gt;
            with those in &amp;lt;table2&amp;gt; and putting it into new &amp;lt;tabout&amp;gt; table. Inner&lt;br /&gt;
            tables in &amp;lt;table1&amp;gt; are replaced with any matching keys (with table&lt;br /&gt;
            values or otherwise) in &amp;lt;table2&amp;gt;.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tabout&amp;gt; MERGE &amp;lt;table1&amp;gt; &amp;lt;table2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            This is identical to the results syntax&lt;br /&gt;
              nM&amp;gt; res t3 ^{table1}^{table2}&lt;br /&gt;
&lt;br /&gt;
            The MERGE/R function is particular useful to merge tables which&lt;br /&gt;
            are similarly formed but may have missing keys.&lt;br /&gt;
&lt;br /&gt;
            Valid modifiers:&lt;br /&gt;
              /L - Do legacy table merge. Since NeXtMidas 2.7.1 and DEPRECATED.&lt;br /&gt;
                   SYNTAX: TABLE &amp;lt;tab&amp;gt; MERGE/L &amp;lt;table1_and_tabout&amp;gt;&lt;br /&gt;
              /R - Recursively merge the tables AND inner tables at the same&lt;br /&gt;
                   level and with the same key name in &amp;lt;table1&amp;gt; and &amp;lt;table2&amp;gt;.&lt;br /&gt;
                   Only valid without /L modifier. Since NeXtMidas 2.7.1.&lt;br /&gt;
&lt;br /&gt;
            See examples below.&lt;br /&gt;
&lt;br /&gt;
  SAVE    - Saves a table to a .tbl file. Note that the file name should include&lt;br /&gt;
            the .tbl extension.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tabin&amp;gt; SAVE &amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  SAVECFG - Saves a table-of-tables to a Windows/Python type .cfg file. Note&lt;br /&gt;
            that the file name should include the .cfg extension. This is&lt;br /&gt;
            effectively the reverse of the LOADCFG function. Since 3.1.3.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tabin&amp;gt; SAVECFG &amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  SETDEFAULTFLAGS - Set the default table flags.&lt;br /&gt;
              SYNTAX: TABLE ,, SETDEFAULTFLAGS &amp;lt;mode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            Note that this can also be set using the ENVIRONMENT command (both&lt;br /&gt;
            commands provide identical functionality).&lt;br /&gt;
&lt;br /&gt;
  SETDEFAULTMODE - Set the default table mode (note: can not set default table&lt;br /&gt;
            mode to FB).&lt;br /&gt;
              SYNTAX: TABLE ,, SETDEFAULTMODE &amp;lt;mode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            Note that this can also be set using the ENVIRONMENT command (both&lt;br /&gt;
            commands provide identical functionality).&lt;br /&gt;
&lt;br /&gt;
  SETFLAGS - Set the table flags specified in &amp;lt;flags&amp;gt; for &amp;lt;tab&amp;gt;.&lt;br /&gt;
             Since NeXtMidas 2.9.3.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; SETFLAGS &amp;lt;flags&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  SETKEY  - Set a &amp;lt;value&amp;gt; at &amp;lt;key&amp;gt; in Table &amp;lt;tab&amp;gt;. Quote the &amp;lt;key&amp;gt; name to put&lt;br /&gt;
            a mixed or all lower case key into the Table. Since NeXtMidas 2.7.1.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; SETKEY &amp;lt;key&amp;gt; &amp;lt;value&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  SETMODE - Set the table mode (note: can not set table mode to FB).&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; SETMODE &amp;lt;mode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  SORT/K  - Sorts a table alphabetically based on the keys. This updates the&lt;br /&gt;
            specified &amp;lt;tab&amp;gt; and will change it's mode to KeyVector. Since&lt;br /&gt;
            NeXtMidas 2.7.0, it is significantly faster to create and use a&lt;br /&gt;
            table with TreeMap (TM) or STM mode.&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; SORT/K&lt;br /&gt;
&lt;br /&gt;
            Valid Modifiers:&lt;br /&gt;
              /R - After sorting, reverse the sort.&lt;br /&gt;
&lt;br /&gt;
  SORT/V  - Sorts a table based on the values in the table. This assumes that&lt;br /&gt;
            all of the values in the table are both homogeneous and Keyable.&lt;br /&gt;
            This updates the specified &amp;lt;tab&amp;gt;.                  (NOT IMPLEMENTED)&lt;br /&gt;
              SYNTAX: TABLE &amp;lt;tab&amp;gt; SORT/V &amp;lt;tags&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            The &amp;lt;tags&amp;gt; parameter is a is a list of the records to sort by in&lt;br /&gt;
            order of importance. Each tag may be prefixed with '+' (sort&lt;br /&gt;
            ascending, the default) or '-' (sort descending). For example&lt;br /&gt;
            &amp;quot;+FREQ|-MAG&amp;quot; sorts the table by FREQ (ascending) and sorts any&lt;br /&gt;
            records with matching FREQ values by MAG (descending).&lt;br /&gt;
&lt;br /&gt;
Escape Sequences in Table:&lt;br /&gt;
--------------------------&lt;br /&gt;
Since NeXtMidas 2.9.0, escape sequences can be used when creating Tables from&lt;br /&gt;
Strings.&lt;br /&gt;
&lt;br /&gt;
   nM&amp;gt; nM&amp;gt; res t:queen {a=&amp;quot;\u265b&amp;quot;}&lt;br /&gt;
   nM&amp;gt; res queen&lt;br /&gt;
   T: QUEEN           = Table of 1 entries&lt;br /&gt;
   1S:  A             = ♛&lt;br /&gt;
&lt;br /&gt;
The escape sequence is the escape character, which is a backslash (&amp;quot;\&amp;quot;),&lt;br /&gt;
followed by a sequence. generally, any escape sequence that can be used in Java&lt;br /&gt;
can be used here. This includes the Unicode escape sequences, which is &amp;quot;\u&amp;quot;&lt;br /&gt;
followed by 4 hex digits, such as the example above, which has the Unicode&lt;br /&gt;
escape sequence for the black queen chess piece.&lt;br /&gt;
&lt;br /&gt;
If you have the backslash in your String and wish to preserve it, use another&lt;br /&gt;
backslash in front of it, just like in Java (and many other languages).&lt;br /&gt;
&lt;br /&gt;
There is a Table flag to disable escape character translation, if desired. This&lt;br /&gt;
flag is able to be set as one of the default Table flags in the ENV table:&lt;br /&gt;
&lt;br /&gt;
  nM&amp;gt; env set DEFAULTTABLEFLAGS +DisableEscapeSequences&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
  1. Make a copy of an existing table&lt;br /&gt;
       nM&amp;gt; res tab {x=1,y=2}&lt;br /&gt;
       nM&amp;gt; tab tab COPY tab2&lt;br /&gt;
&lt;br /&gt;
  2. Create a new empty table&lt;br /&gt;
       nM&amp;gt; table tab CREATE&lt;br /&gt;
&lt;br /&gt;
  3. Sort a table based on its keys.&lt;br /&gt;
       nM&amp;gt; table tab SORT/K     ! Alphabetical order&lt;br /&gt;
       nM&amp;gt; table tab SORT/K/R   ! Reverse alphabetical order&lt;br /&gt;
&lt;br /&gt;
  4. Compare two tables&lt;br /&gt;
       nM&amp;gt; table tab1 EQUALS tab2 equal&lt;br /&gt;
       nM&amp;gt; res equal&lt;br /&gt;
&lt;br /&gt;
  5. Merge two tables without recursion (replace keys at first level)&lt;br /&gt;
       nM&amp;gt; set tbl1 {A=1,B=2,INNER={X=1,Y=1}}&lt;br /&gt;
       nM&amp;gt; set tbl2 {B=20,C=30,D=40,INNER={X=2,Z=2}}&lt;br /&gt;
       nM&amp;gt; table tbl3 MERGE tbl1 tbl2&lt;br /&gt;
       nM&amp;gt; res/all tbl3&lt;br /&gt;
         T: TBL3            = Table of 5 entries&lt;br /&gt;
         L:  A              = 1&lt;br /&gt;
         L:  B              = 20&lt;br /&gt;
         T:  INNER          = Table of 2 entries&lt;br /&gt;
         L:   X             = 2&lt;br /&gt;
         L:   Z             = 2&lt;br /&gt;
         L:  C              = 30&lt;br /&gt;
         L:  D              = 40&lt;br /&gt;
&lt;br /&gt;
    Merge the same two tables WITH recursion (replace keys containing tables at&lt;br /&gt;
    all levels):&lt;br /&gt;
        nM&amp;gt; table tbl3 MERGE/R tbl1 tbl2&lt;br /&gt;
        nM&amp;gt; res/all tbl3&lt;br /&gt;
          T: TBL3            = Table of 5 entries&lt;br /&gt;
          L:  A              = 1&lt;br /&gt;
          L:  B              = 20&lt;br /&gt;
          T:  INNER          = Table of 2 entries&lt;br /&gt;
          L:   X             = 2&lt;br /&gt;
          L:   Z             = 2&lt;br /&gt;
          L:  C              = 30&lt;br /&gt;
          L:  D              = 40&lt;br /&gt;
&lt;br /&gt;
  6. Set/Get a mixed-case key from a table&lt;br /&gt;
       nM&amp;gt; res t:tab1 {}&lt;br /&gt;
       nM&amp;gt; table tab1 SETKEY &amp;quot;mixedCaseKey&amp;quot; &amp;quot;value for mixed case key&amp;quot;&lt;br /&gt;
       nM&amp;gt; table tab1 GETKEY &amp;quot;mixedCaseKey&amp;quot;  value&lt;br /&gt;
       nM&amp;gt; res value&lt;br /&gt;
        24S: VALUE           = value for mixed case key&lt;br /&gt;
       nM&amp;gt; table tab1 GETKEY &amp;quot;mixedCaseKey&amp;quot;&lt;br /&gt;
        24S: mixedCaseKey    = value for mixed case key&lt;br /&gt;
&lt;br /&gt;
  7. Save a table to a Windows/Python type .cfg file&lt;br /&gt;
       nM&amp;gt; res tmpTable {SECTION1={KEY1=&amp;quot;VAL1&amp;quot;,KEY2=&amp;quot;VAL2&amp;quot;},&amp;amp;&lt;br /&gt;
                SECTION2={KEY3=&amp;quot;Val3&amp;quot;,KEY4=&amp;quot;val4&amp;quot;}}&lt;br /&gt;
       nM&amp;gt; TABLE tmpTable SAVECFG test_table_cfg.cfg&lt;br /&gt;
&lt;br /&gt;
  8. Load a Windows/Python type .cfg file (table of tables) into a table&lt;br /&gt;
       nM&amp;gt; res tmpTable2 {}&lt;br /&gt;
       nM&amp;gt; TABLE tmpTable2 LOADCFG test_table_cfg.cfg&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A FEW NOTES REGARDING NEXTMIDAS TABLES:&lt;br /&gt;
=======================================&lt;br /&gt;
  Syntax&lt;br /&gt;
  ------------&lt;br /&gt;
  When defined on the command line or in a macro a table is specified in the&lt;br /&gt;
  following format:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; res t:mytable {TAG1=VAL1,TAG2=VAL2,...,TAGn=VALn}&lt;br /&gt;
&lt;br /&gt;
  Where the table is defined within a pair of braces ({...}) where each element&lt;br /&gt;
  of the table is specified by a TAG=VALUE syntax with a comma (,) separating&lt;br /&gt;
  subsequent elements.&lt;br /&gt;
&lt;br /&gt;
  Note that no translation is done on the values of a table unless they are&lt;br /&gt;
  escaped with a caret:&lt;br /&gt;
    nM&amp;gt; res ten 10&lt;br /&gt;
    nM&amp;gt; res t:mytab {A=ten}&lt;br /&gt;
    nM&amp;gt; res mytab.a&lt;br /&gt;
     3S: MYTAB.A   = TEN&lt;br /&gt;
    nM&amp;gt; res t:mytab {A=^ten}&lt;br /&gt;
    nM&amp;gt; res mytab.a&lt;br /&gt;
      L: MYTAB.A   = 1&lt;br /&gt;
&lt;br /&gt;
  Invalid Syntax&lt;br /&gt;
  ------------&lt;br /&gt;
  Since NeXtMidas 3.3.0 (via the Table flag CheckMalformed, which is off by&lt;br /&gt;
  default), if you fail to follow the syntax above, you will get an exception&lt;br /&gt;
  in the following circumstances:&lt;br /&gt;
    nM&amp;gt; res tab {X=&amp;quot;&amp;quot;Y=2}  ! missing comma&lt;br /&gt;
    nM&amp;gt; res t:tab {X=1,Y=2 ! missing '}' at end of String&lt;br /&gt;
&lt;br /&gt;
  Valid Tag Names&lt;br /&gt;
  ---------------&lt;br /&gt;
  All tags in a table must be one or more characters in length and may contain&lt;br /&gt;
  only numbers, upper-case letters and the underscore. This is basically the&lt;br /&gt;
  same as identifiers in C/C++ except that it may begin with a number and is&lt;br /&gt;
  case-insensitive. Tags may be specified on the command line or in a macro with&lt;br /&gt;
  lower-case letters since they will be automatically converted to upper case by&lt;br /&gt;
  the NeXtMidas shell.&lt;br /&gt;
    Regular Expression for Tag Names: [0-9A-Z_]+&lt;br /&gt;
&lt;br /&gt;
  There is no upper limit to the length of a tag name but users are likely to&lt;br /&gt;
  find that tag names longer than 16 characters are unwieldy to use. Note: Older&lt;br /&gt;
  versions of NeXtMidas allowed tag names to contain dashes (-). This behavior&lt;br /&gt;
  has been deprecated since it caused confusion as to whether a statement like&lt;br /&gt;
  ^MYTBL.FOO-9 represented a single table reference (^{MYTBL.FOO-9}) or a table&lt;br /&gt;
  reference followed by a subtraction (^{MYTBL.FOO}-9).&lt;br /&gt;
&lt;br /&gt;
  Types in a Table&lt;br /&gt;
  ----------------&lt;br /&gt;
  When a table is specified on the command line its type is automatically&lt;br /&gt;
  assigned by the NeXtMidas shell. For example:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; res t:mytable {ONE=1.0,TWO=2.0,TEN=10.0}&lt;br /&gt;
&lt;br /&gt;
  Would create a table with three doubles in it. It is possible to specify the&lt;br /&gt;
  type of the value by giving the appropriate type specifier before the tag name&lt;br /&gt;
  (see Typecasting in a Macro for the list of valid type specifiers). For&lt;br /&gt;
  example:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; res t:mytable {B:ONE=1.0,B:TWO=2.0,F:TEN=10.0}&lt;br /&gt;
&lt;br /&gt;
  Would create a table with two bytes and a float.&lt;br /&gt;
&lt;br /&gt;
  Inside a table, strings should be quoted, numbers should not be quoted, and&lt;br /&gt;
  subtables should be within a pair of braces. For example:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; res t:mytable {NUMBER=1,STRING=&amp;quot;My String&amp;quot;,SUBTABLE={ONE=1,TWO=2}}&lt;br /&gt;
&lt;br /&gt;
  One exception is that single-word strings with no special characters will be&lt;br /&gt;
  accepted even if they are not quoted (though this practice is discouraged).&lt;br /&gt;
&lt;br /&gt;
  Translation&lt;br /&gt;
  -----------&lt;br /&gt;
  When translating a table reference translation always goes to the end unless&lt;br /&gt;
  the translation is done using the caret-brace (^{...}) syntax. Here are a few&lt;br /&gt;
  examples:&lt;br /&gt;
&lt;br /&gt;
     1: nM&amp;gt; res mytable {A=1,B=2,C=3,D={A=10,B=20,C=30},X=9,Y=99,Z=999}&lt;br /&gt;
     2: nM&amp;gt; res a d&lt;br /&gt;
     3: nM&amp;gt; res b {a=&amp;quot;a&amp;quot;,b=&amp;quot;b&amp;quot;,c=&amp;quot;c&amp;quot;,D={A=&amp;quot;x&amp;quot;,B=&amp;quot;y&amp;quot;,C=&amp;quot;z&amp;quot;,D=&amp;quot;z&amp;quot;}}&lt;br /&gt;
     4: nM&amp;gt; res mytable.d.a&lt;br /&gt;
          L: MYTABLE.D.A     = 10&lt;br /&gt;
     5: nM&amp;gt; res mytable.^a.a&lt;br /&gt;
          ERROR: ...&lt;br /&gt;
     6: nM&amp;gt; res mytable.^{a}.a&lt;br /&gt;
          L: MYTABLE.D.A     = 10&lt;br /&gt;
     7: nM&amp;gt; res mytable.^{b.a}.d&lt;br /&gt;
          D: MYTABLE.A.D     = 1.0&lt;br /&gt;
     8: nM&amp;gt; res mytable.^{b.^a.d}&lt;br /&gt;
          ERROR: ...&lt;br /&gt;
     9: nM&amp;gt; res mytable.^{b.^{a}.d}&lt;br /&gt;
          L: MYTABLE.Z       = 999&lt;br /&gt;
    10: nM&amp;gt; res mytable {X=5,Y=2}{X=1,Z=3}&lt;br /&gt;
       is the same as&lt;br /&gt;
        nM&amp;gt; res mytable {X=1,Y=2,Z=3}&lt;br /&gt;
&lt;br /&gt;
  Line 5 causes an error because it tried to access mytable.^{a.a} but a is a&lt;br /&gt;
  string (&amp;quot;d&amp;quot;) not a table. Similarly line 8 attempts to access a.d. To avoid&lt;br /&gt;
  situations such as this the caret-brace syntax is always recommended when&lt;br /&gt;
  dealing with translation in the middle of a table name.&lt;br /&gt;
&lt;br /&gt;
  While the above examples may seem a bit contrived, many applications use the&lt;br /&gt;
  values within one table as the keys used to access another table. It is not&lt;br /&gt;
  uncommon to see the nesting of these two or three levels deep.&lt;br /&gt;
&lt;br /&gt;
  Altering a Table&lt;br /&gt;
  ----------------&lt;br /&gt;
  Once a table has been defined the the values in the table can be easily&lt;br /&gt;
  modified or new values added using the RESULT or SET commands. For example:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; res mytable.a 7.0&lt;br /&gt;
&lt;br /&gt;
  This will set the value A in my table to be the double value 7.0. To set it to&lt;br /&gt;
  a byte use the following:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; res b:mytable.a 7.0&lt;br /&gt;
&lt;br /&gt;
  Note that before adding values to a subtable the subtable must first be&lt;br /&gt;
  inserted:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; res mytable {ONE=1,TWO=2}&lt;br /&gt;
    nM&amp;gt; res mytable.SUBTABLE.a 3&lt;br /&gt;
      ERROR: Table Entry SUBTABLE not found for put of A&lt;br /&gt;
    nM&amp;gt; res mytable.SUBTABLE { }&lt;br /&gt;
    nM&amp;gt; res mytable.SUBTABLE.a 3&lt;br /&gt;
    nM&amp;gt; res mytable.SUBTABLE.a&lt;br /&gt;
      L: MYTABLE.SUBTABLE.A = 3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Values in a table can be removed using the REMOVE command. For example:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; rem mytable.a&lt;br /&gt;
&lt;br /&gt;
  This will remove A from MYTABLE.&lt;br /&gt;
&lt;br /&gt;
  Table Modes and Sorting&lt;br /&gt;
  -----------------------&lt;br /&gt;
  As listed above, table can be set to use one of several internal modes. For&lt;br /&gt;
  comparison purposes, three are described below:&lt;br /&gt;
&lt;br /&gt;
  Mode  Underlying Storage Mechanism  Nominal Order of Operation  Sortable&lt;br /&gt;
                                      Get  Add  Remove&lt;br /&gt;
  ----  ----------------------------  ---  ---  ------            --------&lt;br /&gt;
  KV    NeXtMidas KeyVector           O(n) O(1) O(n)              YES&lt;br /&gt;
  SLHM* Java Synchronized HashMap     O(1) O(1) O(1)              NO&lt;br /&gt;
  FB**  Byte Buffer                   n/a  n/a  n/a               n/a&lt;br /&gt;
&lt;br /&gt;
  *  SLHM is the default mode.&lt;br /&gt;
  ** FB mode is used only for serialization of the table. A table in FB mode&lt;br /&gt;
     will automatically switch to KV mode on first use.&lt;br /&gt;
&lt;br /&gt;
  The tradeoff between KV mode and SLHM mode is sortability versus access time.&lt;br /&gt;
  The TABLE command provides functions that can change the mode of a table and&lt;br /&gt;
  sort a table.&lt;br /&gt;
&lt;br /&gt;
  View the Table javadocs for a complete comparison of modes.&lt;br /&gt;
&lt;br /&gt;
  CLONE -vs- REFERENCE&lt;br /&gt;
  --------------------&lt;br /&gt;
  A table can be cloned (copied) such that the copy is stored in a separate&lt;br /&gt;
  memory location from the original.  A change to the clone will not affect the&lt;br /&gt;
  original.  When two tables need to refer to the same result a reference&lt;br /&gt;
  can be created such that a change using either reference variable changes&lt;br /&gt;
  the value seen by both.  A results table example illustrates these&lt;br /&gt;
  relationships:&lt;br /&gt;
&lt;br /&gt;
    nM&amp;gt; set origtable {x=1,y=2} (create a table and assign some values)&lt;br /&gt;
    nM&amp;gt; set table1 origtable    (create a reference to the original table)&lt;br /&gt;
    nM&amp;gt; set table2 ^origtable   (clone/copy the original table)&lt;br /&gt;
    nM&amp;gt; set table1.x 9          (modify x value in table 1)&lt;br /&gt;
    nM&amp;gt; res table1.x            (x=9 because table 1 value was modified)&lt;br /&gt;
    nM&amp;gt; res table2.x            (x=1 because the copy remains unchanged)&lt;br /&gt;
    nM&amp;gt; res origtable.x         (x=9 table1 references same memory as origtable)&lt;br /&gt;
&lt;br /&gt;
Switches:&lt;br /&gt;
  /FLAGS= - Table flags mask/settings to use for LOAD/SAVE functions.&lt;br /&gt;
            Use LOAD/T function along with this switch to ensure that the output&lt;br /&gt;
            table and all it's sub-tables use specified flags. The SAVE function&lt;br /&gt;
            only uses the DisableEscapeSequences and SerializeTimeAsTColon flags.&lt;br /&gt;
            Mask Options are:&lt;br /&gt;
              Add,AddRoot,AutoReadPrev,AutoWritePrev,&lt;br /&gt;
              CaseSensitive,DisableEscapeSequences,ExceptionOnNull,&lt;br /&gt;
              Force,OnlyDotIntoSubTables,ReadOnly,CheckMalformed,&lt;br /&gt;
              SerializeTimeAsTColon&lt;br /&gt;
            (Since 3.1.2 for LOAD and 3.5.3 for SAVE/SerializeTimeAsTColon)&lt;br /&gt;
&lt;br /&gt;
See Also: ENVIRONMENT, nxm.sys.lib.Table&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:NXM_Explain]]&lt;/div&gt;</summary>
		<author><name>ConvertBot</name></author>
		
	</entry>
</feed>