Purpose |
With
CreateTable
you can create a GuiXT table
variable. |
Example |
CreateTable
V[customers]
account name city country
The variable
V[customers]
is created as a table variable. For each row
1,2,3... the components
V[customers.account.1] V[customers.name.1] V[customers.city]
V[customers.country.1]
V[customers.account.2] V[customers.name.2] ....
can
be used as individual variables.
|
Format |
CreateTable
V[tabname]
field1 field2 field3 ...
|
Explanation |
- In contrast to normal
variables, invalid component names, e.g.
V[customers.xxx.1]
cause a syntax error message.
- For non-existing row
numbers the following rules apply:
Reading a table cell with a
non-existing row number returns "". Writing into a table cell with a
non-existing row number first creates the row with empty cells and
then writes the value into the specified cell. It also creates all
intermediate rows with empty cell values, for example rows 2 to 99
when you write into row 100 and only row 1 exists.
- The total number of
rows is
V[tabname.rowcount],
the number of columns
V[tabname.colcount]
- You may change the
rowcount
V[tabname.rowcount]
directly with
Set. For example, when you intend to
fill a table with many lines, it is quicker to first set the total
row count and then to set all cell values.
- Column names can be
read with the notation
V[tabname.colname.k] e.g.
"&V[customers.colname.3]" is "city".
-
With
Clear
V[tabname]
all rows are removed and
V[tabname.rowcount]is
set to 0.
-
You may use the notation
V[customers.cell.account.1]
instead of
V[customers.account.1].
This is supported to assure compatibility with the table display
using the
Table command.
-
All status variables
V[tabname.stat. ...1]
used in the table display with
Table keep their values.
If necessary you can clear them explicitely with
Clear
V[tabname.stat*].
-
The string representation
"&V[tabname]"
of a table variable generates a "JSON" format which is
compatible with the JavaScript object notation. Example
Set
V[customers.account.1]
"1000" Set
V[customers.name.1]
"M&S
Inc."
Set
V[customers.account.4]
"2000" Set
V[customers.name.4]
"ABC
Inc."
For &V[customers]
the following string is generated:
[{"account": "1000", "name": "M&S
Inc.", "city": "", "country": ""},
{"account": "", "name": "", "city": "", "country": ""}, {"account":
"", "name": "", "city": "", "country": ""}, {"account": "2000",
"name": "ABC Inc.", "city": "", "country": ""}]
-
You can use the same JSON type notation in order to set a table
variable value
-
Since the normal GuiXT variables are limited to 4000 bytes, use
GuiXT long text variables if you expect a large table. The commands
are
CopText
...fromTable= ...
-json
and
CopText
...toTable=... JSON
|
Options
|
include= |
Refers
to another structured variable or table variable. The components
of this variable are included. Example:
CreateStructure
V[customer]
account name city country CreateTable
V[tab1]
include=V[customer]
CreateTable
V[tab2]
include=V[customer]
You may use the
include= option multiple times.
|
|
Further
commands for table variables |
DeleteTable |
Removes the table variable (content and structure) |
Clear |
Deletes all rows, keeps the structure. |
ReadRow |
Reads a table row into a structured variable |
UpdateRow |
Updates a table row from a structured variable |
AppendRow |
Appends the content of a stuctured variable as a new row of
the table variable |
InsertRow |
Inserts the content of a stuctured variable as a new row at a
given position |
DeleteRow |
Deletes a table row |
Sort |
Sorts the table variable rows
|
CopyText |
with
options
toTable=
and
fromTable=
Copies a table variable into a long text
variable and vice versa |
Call |
When using the Open Call Interface you can specify table
variables as
export= and
import=
parameters.
The table columns are copied by name from or to a function
module table parameter. |
|
Please note |
Maximum column
number |
In a
single
CreateTable
statement up to 60 columns can be specified directly. If you
need more columns, please split them with
include=.
Example with 80 columns:
CreateStructure
V[s1]
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10
CreateStructure
V[s2]
f11 f12 f13 f14 f15 f16 f17 f18 f19 f20
CreateStructure
V[s3]
f21 f22 f23 f24 f25 f26 f27 f28 f29 f30
CreateStructure
V[s4]
f31 f32 f33 f34 f35 f36 f37 f38 f39 f40
CreateStructure
V[s5]
f41 f42 f43 f44 f45 f46 f47 f48 f49 f50
CreateStructure
V[s6]
f51 f52 f53 f54 f55 f56 f57 f58 f59 f60
CreateStructure
V[s7]
f61 f62 f63 f64 f65 f66 f67 f68 f69 f70
CreateStructure
V[s8]
f71 f72 f73 f74 f75 f76 f77 f78 f79 f80
CreateTable
V[mytab]
include=V[s1]
include=V[s2]
include=V[s3]
include=V[s4]
include=V[s5]
include=V[s6]
include=V[s7]
include=V[s8] |
|
Examples |
Numerous examples can be found in our "Tips,Tricks & Samples"
section in "Table variables" and "Open call Interface"
|
Components |
GuiXT +
InputAssistant |