-
Notifications
You must be signed in to change notification settings - Fork 2
Auto Table Constructor Scripts
how a table structure is defined via Auto Table Constructor Script is as follows:
this is how to define each type of column, the column name must be between <>
, and columns must be separated by commas ",":
-
Text:
<column_name>:T
-
Numerical:
<column_name>:N
-
Integer:
<column_name>:I
-
Subtable:
<column_name>:S:{...internal_column_script_structure...}
-
Bool: "
<column_name>:B
-
Foreign Key Refrence:
<column_name>:F:<refrenced_table_name>
-
Parent Subtable Foreign Key Reference:
<column_name>:PF:<outward_directory>
To define the "outward_directory" you can assume that the table is a file directory and the current directory/base directory is where the Parent Subtable Foreign Key Refrence column is located.
You must travel outwards in the directory to reach the desired subtable, to escape the current directory by one table level use '-'
example: if the AutoTableConstructorScriptReceiver column subtable containing this column is located in: < "SCol Name0"/"SCol Name1"/"AutoTableConstructorScriptReceiver Column Name" >
and you want to reach an adjacent subtable in <"SCol Name0"/"SCol Name1"/...> called "Adjacent SCol Name1", you can enter the directory as < -/"Adjacent SCol Name1" > (quotations included).
- with '-' you are escaping once to the previous table level ("SCol Name1")
- then you are entering a different subtable column called "Adjacent SCol Name1"
- Note1: you don't necessarily need to enter an adjacent subtable, <-/-> is a valid outward_directory.
- Note2: you cannot escape to nor beyond the main table directory and must reference a subtable column.
- Note3: only the immediate table level of Adjacent subtable columns to the base directory referenced is used, so <-/"Adj Sub"/"Sub2"> is invalid.
- Note4: spacing outside of quotes is trimmed.
- Note5: you cannot reference a subtable column within a constructed table (this is mostly irrelevant though as there are is no primary key support within TableConstructorScript).
This "outward directory" structure is designed to consider that, if any columnnames in the directory are changed, it won't affect the directory within the script unless it's the name of an adjacent subtable columnname that is being referenced.
-
Auto Table Constructor Script Receiver:
<column_name>:A:<linked_fKey_column_name><linked_fKey_column_name2>...
(linked_fKey_column_name
s must be an adjacent column at the same table level.)
-
To add a single row restriction to a constructed table or sub-table, add a hashtag "#" at the beginning of the script (there cannot be spaces before this hashtag) (this works within constructed subtables by adding the hashtag right after the first curly brace)
-
To define pairs of columns that disable eachother, you would define an array like so :
[[<colName1>,<colName2>,<colname4>][<colname1>,<colname3>]]
The columns that are joined within a nested array will disable the other columns in the same array upon one being filled.- This array should be placed at the beginning of the script (after the single row restriction hashtag
#
if there is one). - Nested arrays in this array must also contain 2 or more column names or else they are not valid.
- This array should be placed at the beginning of the script (after the single row restriction hashtag
-
Any spaces before or after the column names and type shorthand are trimmed so there's no need to worry about spacing, so
<Bool Column> : B , ...
will correct to<Bool Column>:B,...
-
A red outline will appear over cells with scripting errors, and a popup that will warn the user of errors within the script will appear after a cell's data has been updated.
# <Bool Column>:B, <Subtable Column>:S:{<Sub Bool Column>:B,<Sub Text Column>:T }, <Text Column>:T, <Foreign Key Refrence Column>:F:<My Table Name>
-
The "Auto Table Constructor Script Column" must be within the main table and a "Primary Key Column" must exist within the same table. Only one Auto Table Constructor Script Column can exist per table.
-
The "Auto Table Constructor Script Receiver Column" must link to one or more "Foreign Key Reference Columns" that exist within the same table level. Cells of the "Auto Table Constructor Script Receiver Column" will use the primary key value within the linked "Foreign Key Reference Column" cell at the same row to reference the table constructor script column data that exists at the same row as the Primary Key being referenced by the linked column. And this can be done with multiple linked FKey columns at once (the fetched table constructor scripts are merged together if multiple linked columns are filled).
So... "Auto Table Constructor Script Receiver Column" > "Linked Foreign Key Reference Column" > "Table Being Referenced By Foreign Key Reference Column" > "Row Being Referenced by Primary Key Selected Within Linked Foreign Key Reference Column" > "Auto Table Constructor Script Column Data At Said Row"
Here's an example of the setup in action (this is before support for multiple linked FKey columns so some parts of this example are outdated):
Script Prefabs can be used to insert a pre-defined script into a Auto Table Constructor Script via the script prefab key surrounded by brackets
Example: if
x
is the prefab key,(x)
is how it would be inserted into your script, ifx
represents the script of a column as it's value (i.e.x
=<col2>:T
) then it could be inserted into a script like so:<col1>:T, (X), <col3>:T
.
The prefab editor is opened by selecting "Edit Script Prefabs" under "Script Settings" top menu bar item.
Prefab data is stored under "C:\Users\USERNAME\AppData\Local\MDB......" but is also within the .mdb files themselves (the .mdb file data takes priority over the config data in cases where there are two prefab keys of the same name)
Duplicate Auto Table Constructor Script
and Auto Table Constructor Script Receiver
column pairs can be defined in "Set Script Column Type Duplicates" under the "Script Settings" top menu bar item. These column type duplicates are indexed starting at 1
. Receiver columns only speak to script columns of the same duplicate index; this way you can have multiple parallel scripts retrieved from a single FKey column by linking multiple receiver columns of different duplicate indexes to that column.
-
the "Regex Reference Table Constructor Editor" prompt allows you to add multiple
Auto Table Constructor Script
columns, with each column after the first being an indexed duplicate column type. -
Auto Table Constructor Script can also construct duplicate
Auto Table Constructor Script Receiver
column types by just adding the index after the column type shorthand (e.g: "A1","A2","A3",... up to the Script Column Type Duplicates value defined in the Script Settings)