Difference between revisions of "DAT Class"

From TouchDesigner Documentation
Jump to: navigation, search
(DAT Class Auto Create)
Line 8: Line 8:
 
     |class=DAT
 
     |class=DAT
 
     |name=export
 
     |name=export
     |type=
+
     |type=bool
     |set=0
+
     |set=1
 
     |text=Get or set export flag
 
     |text=Get or set export flag
 
}}
 
}}
Line 15: Line 15:
 
     |class=DAT
 
     |class=DAT
 
     |name=isDAT
 
     |name=isDAT
     |type=
+
     |type=bool
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a DAT.
 
     |text=True if the operator is a DAT.
Line 22: Line 22:
 
     |class=DAT
 
     |class=DAT
 
     |name=isTable
 
     |name=isTable
     |type=
+
     |type=bool
 
     |set=0
 
     |set=0
 
     |text=True if the DAT contains table formatted data.
 
     |text=True if the DAT contains table formatted data.
Line 29: Line 29:
 
     |class=DAT
 
     |class=DAT
 
     |name=isText
 
     |name=isText
     |type=
+
     |type=bool
 
     |set=0
 
     |set=0
 
     |text=True if the DAT contains text formatted data. (ie, not table formatted).
 
     |text=True if the DAT contains text formatted data. (ie, not table formatted).
Line 36: Line 36:
 
     |class=DAT
 
     |class=DAT
 
     |name=locals
 
     |name=locals
     |type=
+
     |type=dict
 
     |set=0
 
     |set=0
     |text=Local dictionary used during python execution of scripts in this DAT. The dictionary attribute is read only, but not its contents. Its contents may be manipulated directly with scripts, or with an Examine DAT.
+
     |text=Local dictionary used during python execution of scripts in this DAT. The dictionary attribute is read only, but not its contents. Its contents may be manipulated directly with scripts, or with an Examine DAT.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=DAT
 
     |class=DAT
 
     |name=module
 
     |name=module
     |type=
+
     |type=module
 
     |set=0
 
     |set=0
 
     |text=Retrieve the contents of the DAT as a module. This allows for functions in the module to be called directly. E.g n.module.function(arg1, arg2)
 
     |text=Retrieve the contents of the DAT as a module. This allows for functions in the module to be called directly. E.g n.module.function(arg1, arg2)
Line 50: Line 50:
 
     |class=DAT
 
     |class=DAT
 
     |name=numCols
 
     |name=numCols
     |type=
+
     |type=int
 
     |set=0
 
     |set=0
 
     |text=Number of columns in the DAT table.
 
     |text=Number of columns in the DAT table.
Line 57: Line 57:
 
     |class=DAT
 
     |class=DAT
 
     |name=numRows
 
     |name=numRows
     |type=
+
     |type=int
 
     |set=0
 
     |set=0
 
     |text=Number of rows in the DAT table.
 
     |text=Number of rows in the DAT table.
Line 64: Line 64:
 
     |class=DAT
 
     |class=DAT
 
     |name=text
 
     |name=text
     |type=
+
     |type=str
     |set=0
+
     |set=1
     |text=Get or set contents. Tables are treated as tab delimited columns, newline delimited rows.
+
     |text=Get or set contents. Tables are treated as tab delimited columns, newline delimited rows.
 
}}}}
 
}}}}
 
{{ClassMethodSection|empty=
 
{{ClassMethodSection|empty=
Line 76: Line 76:
 
     |name=rows
 
     |name=rows
 
     |call=rows(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
 
     |call=rows(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
     |returns=
+
     |returns=list of lists
     |text=: -> list of lists
+
     |text=Returns a (possibly empty) list of rows (each row being a list of cells). If no arguments are given it returns all rows in the table.
Returns a (possibly empty) list of rows (each row being a list of cells). If no arguments are given it returns all rows in the table.
 
 
See DAT.rows() for similar usage.
 
See DAT.rows() for similar usage.
 +
<syntaxhighlight lang=python>
 
for r in op('table1').rows():
 
for r in op('table1').rows():
# do something with row 'r'
+
# do something with row 'r'
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 87: Line 88:
 
     |name=appendCol
 
     |name=appendCol
 
     |call=appendCol(vals, nameOrIndex, sort=None)
 
     |call=appendCol(vals, nameOrIndex, sort=None)
     |returns=
+
     |returns=int
     |text=: -> int
+
     |text=Append a column to the end of the table. See appendRow for similar usage.
Append a column to the end of the table. See appendRow for similar usage.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 95: Line 95:
 
     |name=insertCol
 
     |name=insertCol
 
     |call=insertCol(vals, nameOrIndex, sort=None)
 
     |call=insertCol(vals, nameOrIndex, sort=None)
     |returns=
+
     |returns=int
     |text=: -> int
+
     |text=Insert a column to the beginning of the table or before the specified row name/index. See DAT.appendRow() for similar usage.
Insert a column to the beginning of the table or before the specified row name/index. See DAT.appendRow() for similar usage.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 103: Line 102:
 
     |name=row
 
     |name=row
 
     |call=row(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
 
     |call=row(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
     |returns=
+
     |returns=list
     |text=: -> list
+
     |text=Returns a list of cells from the row matching the name/index, or None if nothing is found.
Returns a list of cells from the row matching the name/index, or None if nothing is found.
 
 
See DAT.col() for similar usage.
 
See DAT.col() for similar usage.
 
}}
 
}}
Line 112: Line 110:
 
     |name=col
 
     |name=col
 
     |call=col(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
 
     |call=col(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
     |returns=
+
     |returns=list
     |text=: -> list
+
     |text=Returns a list of all the cells in a column, or None if nothing is found.
Returns a list of all the cells in a column, or None if nothing is found.
+
*nameOrIndex - If a string it specifies a column name, if it's numeric it specifies a column index. Pattern Matching is supported.
nameOrIndex - If a string it specifies a column name, if it's numeric it specifies a column index. Pattern Matching is supported.
+
*caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
+
<syntaxhighlight lang=python>
 
r = op('table1').col(3, caseSensitive=False)
 
r = op('table1').col(3, caseSensitive=False)
 
r = op('table1').col('June')
 
r = op('table1').col('June')
 
r = op('table1').col('A*', 'B*') #returns first column beginning with A or B
 
r = op('table1').col('A*', 'B*') #returns first column beginning with A or B
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 125: Line 124:
 
     |name=clear
 
     |name=clear
 
     |call=clear(keepSize=False, keepFirstRow=False, keepFirstCol=False)
 
     |call=clear(keepSize=False, keepFirstRow=False, keepFirstCol=False)
     |returns=
+
     |returns=None
     |text=:
+
     |text=Remove all rows and columns from the table.
Remove all rows and columns from the table.
+
*keepSize - (Keyword, Optional) If set to True, size is unchanged, but entries will be set to blank, dependent on other options below.
keepSize - (Keyword, Optional) If set to True, size is unchanged, but entries will be set to blank, dependent on other options below.
+
*keepFirstRow - (Keyword, Optional) If set to True, the first row of cells are retained.
keepFirstRow - (Keyword, Optional) If set to True, the first row of cells are retained.
+
*keepFirstCol - (Keyword, Optional) If set to True, the first column of cells are retained.
keepFirstCol - (Keyword, Optional) If set to True, the first column of cells are retained.
+
<syntaxhighlight lang=python>
 
n.clear() #remove all rows and columns
 
n.clear() #remove all rows and columns
 
n.clear(keepSize=True) #set all table cells to blank
 
n.clear(keepSize=True) #set all table cells to blank
 
n.clear(keepFirstRow=True) #remove all rows, but keep the first
 
n.clear(keepFirstRow=True) #remove all rows, but keep the first
 
n.clear(keepFirstRow=True, keepFirstCol=True) #keep the first row, first column, and set remaining cells to blank
 
n.clear(keepFirstRow=True, keepFirstCol=True) #keep the first row, first column, and set remaining cells to blank
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 140: Line 140:
 
     |name=write
 
     |name=write
 
     |call=write(args)
 
     |call=write(args)
     |returns=
+
     |returns=str
     |text=: -> string
+
     |text=Append content to this DAT. Can also be used to implement DAT printing functions.
Append content to this DAT. Can also be used to implement DAT printing functions.
+
<syntaxhighlight lang=python>
 
# grab DAT
 
# grab DAT
 
n = op('text1')
 
n = op('text1')
Line 149: Line 149:
 
# use print method
 
# use print method
 
print('Hello World', file=n)
 
print('Hello World', file=n)
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 154: Line 155:
 
     |name=cols
 
     |name=cols
 
     |call=cols(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
 
     |call=cols(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
     |returns=
+
     |returns=list of lists
     |text=: -> list of lists
+
     |text=Returns a (possibly empty) list of columns (each being a list themselves). See DAT.col for similar usage. If no arguments are given then all columns in the table are returned.
Returns a (possibly empty) list of columns (each being a list themselves). See DAT.col for similar usage. If no arguments are given then all columns in the table are returned.
+
*nameOrIndex - (Optional) If a string it specifies a column name, if it's numeric it specifies a column index. Pattern Matching is supported.
nameOrIndex - (Optional) If a string it specifies a column name, if it's numeric it specifies a column index. Pattern Matching is supported.
+
*caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
+
<syntaxhighlight lang=python>
 
for c in op('table1').cols():
 
for c in op('table1').cols():
# do something with each column 'c'
+
# do something with each column 'c'
 +
<syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 166: Line 168:
 
     |name=deleteCol
 
     |name=deleteCol
 
     |call=deleteCol(nameOrIndex)
 
     |call=deleteCol(nameOrIndex)
     |returns=
+
     |returns=None
     |text=:
+
     |text=Delete a single column at the specified column name or index.
Delete a single column at the specified column name or index.
+
*nameOrIndex - May be a string for a column name, or numeric index for column index.
nameOrIndex - May be a string for a column name, or numeric index for column index.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 175: Line 176:
 
     |name=cells
 
     |name=cells
 
     |call=cells(rowNameOrIndex, colNameOrIndex, caseSensitive=True)
 
     |call=cells(rowNameOrIndex, colNameOrIndex, caseSensitive=True)
     |returns=
+
     |returns=list
     |text=: -> list
+
     |text=Returns a (possibly empty) list of cells that match the given row/column names or indices. See DAT.cell method for similar usage.
Returns a (possibly empty) list of cells that match the given row/column names or indices. See DAT.cell method for similar usage.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 183: Line 183:
 
     |name=save
 
     |name=save
 
     |call=save(filepath, append=False)
 
     |call=save(filepath, append=False)
     |returns=
+
     |returns=str
     |text=: -> string
+
     |text=Saves the content of the DAT to the file system. Returns the file path that it was saved to.
Saves the content of the DAT to the file system. Returns the file path that it was saved to.
+
*filepath - (Optional) The path and filename to save the file to. If this is not given then a default named file will be saved to project.folder
filepath - (Optional) The path and filename to save the file to. If this is not given then a default named file will be saved to project.folder
+
*append - (Keyword, Optional) If set to True and the format is txt, then the contents are appended to the existing file.
append - (Keyword, Optional) If set to True and the format is txt, then the contents are appended to the existing file.
+
<syntaxhighlight lang=python>
 
name = n.save() #save in native format with default name
 
name = n.save() #save in native format with default name
 
n.save('output.txt') #human readable format without channel names
 
n.save('output.txt') #human readable format without channel names
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 195: Line 196:
 
     |name=setSize
 
     |name=setSize
 
     |call=setSize(numrows, numcols)
 
     |call=setSize(numrows, numcols)
     |returns=
+
     |returns=None
     |text=:
+
     |text=Set the exact size of the table.
Set the exact size of the table.
+
*numrows - The number of rows the table should have.
numrows - The number of rows the table should have.
+
*numcols - The number of columns the table should have.
numcols - The number of columns the table should have.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 205: Line 205:
 
     |name=deleteRow
 
     |name=deleteRow
 
     |call=deleteRow(nameOrIndex)
 
     |call=deleteRow(nameOrIndex)
     |returns=
+
     |returns=None
     |text=:
+
     |text=Delete a single row at the specified row name or index.
Delete a single row at the specified row name or index.
+
*nameOrIndex - May be a string for a row name, or numeric index for rowindex.
nameOrIndex - May be a string for a row name, or numeric index for rowindex.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 214: Line 213:
 
     |name=appendRow
 
     |name=appendRow
 
     |call=appendRow(vals, nameOrIndex, sort=None)
 
     |call=appendRow(vals, nameOrIndex, sort=None)
     |returns=
+
     |returns=int
     |text=: -> int
+
     |text=Append a row to the end of the table, or after the specified row name/index.  Returns the integer index of the new row.
Append a row to the end of the table, or after the specified row name/index.  Returns the integer index of the new row.
+
*vals - (Optional) If specified, will fill the row with the given values. It should be a list of items that can be expressed as strings.  Each item will be copied to one cell.
vals - (Optional) If specified, will fill the row with the given values. It should be a list of items that can be expressed as strings.  Each item will be copied to one cell.
+
*nameOrIndex - (Optional) If specified will determine where the new row will be appended. If it's a numeric value it represents the numeric index of the row. If it is a string it represents a row label.
nameOrIndex - (Optional) If specified will determine where the new row will be appended. If it's a numeric value it represents the numeric index of the row. If it is a string it represents a row label.
+
*sort - (Keyword, Optional) If specified will determine the column to keep sorted after the insertion. If it's a numeric value it represents the numeric index of the column. If it is a string it represents a column label.
sort - (Keyword, Optional) If specified will determine the column to keep sorted after the insertion. If it's a numeric value it represents the numeric index of the column. If it is a string it represents a column label.
+
<syntaxhighlight lang=python>
 
n.appendRow()
 
n.appendRow()
 
n.appendRow( [1,2,3], 'January' )  #append with values (1,2,3) after the row labelled 'January'
 
n.appendRow( [1,2,3], 'January' )  #append with values (1,2,3) after the row labelled 'January'
 
n.appendRow( [1,2,3], 5 )  #append row with values (1,2,3) after the row 5.
 
n.appendRow( [1,2,3], 5 )  #append row with values (1,2,3) after the row 5.
 
n.appendRow( [1,2,3], sort='Month' )  #append row with values (1,2,3) keeping column 'Month' sorted.
 
n.appendRow( [1,2,3], sort='Month' )  #append row with values (1,2,3) keeping column 'Month' sorted.
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 229: Line 229:
 
     |name=cell
 
     |name=cell
 
     |call=cell(rowNameOrIndex, colNameOrIndex, caseSensitive=True)
 
     |call=cell(rowNameOrIndex, colNameOrIndex, caseSensitive=True)
     |returns=
+
     |returns=td.Cell or None
     |text=: -> Cell or None
+
     |text=Find a single cell in the table, or None if none are found.
Find a single cell in the table, or None if none are found.
+
*rowNameOrIndex/colNameOrIndex - If a string it specifies a row/column name. If it's numeric it specifies a row/column index. Pattern Matching is supported for strings.
rowNameOrIndex/colNameOrIndex - If a string it specifies a row/column name. If it's numeric it specifies a row/column index. Pattern Matching is supported for strings.
+
*caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
+
<sytaxhighlight lang=python>
 
c = n.cell(5, 'June') #Return a cell under row 5, column 'June'.
 
c = n.cell(5, 'June') #Return a cell under row 5, column 'June'.
 
c = n.cell('A*', 2) #Find a cell under any row beginning with an A, in column 2.
 
c = n.cell('A*', 2) #Find a cell under any row beginning with an A, in column 2.
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 241: Line 242:
 
     |name=copy
 
     |name=copy
 
     |call=copy(DAT)
 
     |call=copy(DAT)
     |returns=
+
     |returns=None
     |text=:
+
     |text=Copy the text or table from the specified DAT operator.
Copy the text or table from the specified DAT operator.
+
*OP - The DAT operator whose contents should be copied into the DAT.
OP - The DAT operator whose contents should be copied into the DAT.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 250: Line 250:
 
     |name=run
 
     |name=run
 
     |call=run(arg1, arg2..., endFrame=False, fromOP=None, group=None, delayFrames=0, delayMilliSeconds=0, delayRef=me)
 
     |call=run(arg1, arg2..., endFrame=False, fromOP=None, group=None, delayFrames=0, delayMilliSeconds=0, delayRef=me)
     |returns=
+
     |returns=td.Run
     |text=: -> Run
+
     |text=Run the contents of the DAT as a script, returning a Run object which can be used to optionally modify its execution.
Run the contents of the DAT as a script, returning a Run object which can be used to optionally modify its execution.
+
*arg - (Optional) Arguments that will be made available to the script in a local tuple named args.
arg - (Optional) Arguments that will be made available to the script in a local tuple named args.
+
*endFrame - (Keyword, Optional) If set to True, the execution will be delayed until the end of the current frame.
endFrame - (Keyword, Optional) If set to True, the execution will be delayed until the end of the current frame.
+
*fromOP - (Keyword, Optional) Specifies an optional operator from which the execution will be run relative to.
fromOP - (Keyword, Optional) Specifies an optional operator from which the execution will be run relative to.
+
*group - (Keyword, Optional) Can be used to specify a group label string. This label can then be used with the td.runs object to modify its execution.
group - (Keyword, Optional) Can be used to specify a group label string. This label can then be used with the td.runs object to modify its execution.
+
*delayFrames - (Keyword, Optional) Can be used to delay the execution a specific amount of frames.
delayFrames - (Keyword, Optional) Can be used to delay the execution a specific amount of frames.
+
*delayMilliSeconds - (Keyword, Optional) Can be used to delay the execution a specific amount of milliseconds.  This value is rounded to the nearest frame.
delayMilliSeconds - (Keyword, Optional) Can be used to delay the execution a specific amount of milliseconds.  This value is rounded to the nearest frame.
+
*delayRef - (Keyword, Optional) Specifies an optional operator from which the delay time is derived.
delayRef - (Keyword, Optional) Specifies an optional operator from which the delay time is derived.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 265: Line 264:
 
     |name=insertRow
 
     |name=insertRow
 
     |call=insertRow(vals, nameOrIndex, sort=None)
 
     |call=insertRow(vals, nameOrIndex, sort=None)
     |returns=
+
     |returns=int
     |text=: -> int
+
     |text=Insert a row to the beginning of the table or before the specified row name/index.  See DAT.appendRow() for similar usage.
Insert a row to the beginning of the table or before the specified row name/index.  See DAT.appendRow() for similar usage.
 
 
}}}}
 
}}}}
 
<section end=HELPBODY />
 
<section end=HELPBODY />
 
{{History}}
 
{{History}}
 
{{#invoke:Category|list|Python Reference}}
 
{{#invoke:Category|list|Python Reference}}

Revision as of 14:48, 25 September 2017

A DAT describes a reference to a DAT operator.


Members[edit]

exportbool :

Get or set export flag

isDATbool (Read Only):

True if the operator is a DAT.

isTablebool (Read Only):

True if the DAT contains table formatted data.

isTextbool (Read Only):

True if the DAT contains text formatted data. (ie, not table formatted).

localsdict (Read Only):

Local dictionary used during python execution of scripts in this DAT. The dictionary attribute is read only, but not its contents. Its contents may be manipulated directly with scripts, or with an Examine DAT.

modulemodule (Read Only):

Retrieve the contents of the DAT as a module. This allows for functions in the module to be called directly. E.g n.module.function(arg1, arg2)

numColsint (Read Only):

Number of columns in the DAT table.

numRowsint (Read Only):

Number of rows in the DAT table.

textstr :

Get or set contents. Tables are treated as tab delimited columns, newline delimited rows.

Methods[edit]

rows(nameOrIndex1, nameOrIndex2..., caseSensitive=True)list of lists:

Returns a (possibly empty) list of rows (each row being a list of cells). If no arguments are given it returns all rows in the table.

See DAT.rows() for similar usage.

for r in op('table1').rows():
	# do something with row 'r'

appendCol(vals, nameOrIndex, sort=None)int:

Append a column to the end of the table. See appendRow for similar usage.

insertCol(vals, nameOrIndex, sort=None)int:

Insert a column to the beginning of the table or before the specified row name/index. See DAT.appendRow() for similar usage.

row(nameOrIndex1, nameOrIndex2..., caseSensitive=True)list:

Returns a list of cells from the row matching the name/index, or None if nothing is found. See DAT.col() for similar usage.

col(nameOrIndex1, nameOrIndex2..., caseSensitive=True)list:

Returns a list of all the cells in a column, or None if nothing is found.

  • nameOrIndex - If a string it specifies a column name, if it's numeric it specifies a column index. Pattern Matching is supported.
  • caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
r = op('table1').col(3, caseSensitive=False)
r = op('table1').col('June')
r = op('table1').col('A*', 'B*') #returns first column beginning with A or B

clear(keepSize=False, keepFirstRow=False, keepFirstCol=False)None:

Remove all rows and columns from the table.

  • keepSize - (Keyword, Optional) If set to True, size is unchanged, but entries will be set to blank, dependent on other options below.
  • keepFirstRow - (Keyword, Optional) If set to True, the first row of cells are retained.
  • keepFirstCol - (Keyword, Optional) If set to True, the first column of cells are retained.
n.clear() #remove all rows and columns
n.clear(keepSize=True) #set all table cells to blank
n.clear(keepFirstRow=True) #remove all rows, but keep the first
n.clear(keepFirstRow=True, keepFirstCol=True) #keep the first row, first column, and set remaining cells to blank

write(args)str:

Append content to this DAT. Can also be used to implement DAT printing functions.

# grab DAT
n = op('text1')
# append message directly to DAT
n.write('Hello World')
# use print method
print('Hello World', file=n)

cols(nameOrIndex1, nameOrIndex2..., caseSensitive=True)list of lists:

Returns a (possibly empty) list of columns (each being a list themselves). See DAT.col for similar usage. If no arguments are given then all columns in the table are returned.

  • nameOrIndex - (Optional) If a string it specifies a column name, if it's numeric it specifies a column index. Pattern Matching is supported.
  • caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
for c in op('table1').cols():
	# do something with each column 'c'
<syntaxhighlight>
}}
{{ClassMethod
    |class=DAT
    |name=deleteCol
    |call=deleteCol(nameOrIndex)
    |returns=None
    |text=Delete a single column at the specified column name or index.
*nameOrIndex - May be a string for a column name, or numeric index for column index.
}}
{{ClassMethod
    |class=DAT
    |name=cells
    |call=cells(rowNameOrIndex, colNameOrIndex, caseSensitive=True)
    |returns=list
    |text=Returns a (possibly empty) list of cells that match the given row/column names or indices. See DAT.cell method for similar usage.
}}
{{ClassMethod
    |class=DAT
    |name=save
    |call=save(filepath, append=False)
    |returns=str
    |text=Saves the content of the DAT to the file system. Returns the file path that it was saved to.
*filepath - (Optional) The path and filename to save the file to. If this is not given then a default named file will be saved to project.folder
*append - (Keyword, Optional) If set to True and the format is txt, then the contents are appended to the existing file.
<syntaxhighlight lang=python>
name = n.save() #save in native format with default name
n.save('output.txt') #human readable format without channel names

setSize(numrows, numcols)None:

Set the exact size of the table.

  • numrows - The number of rows the table should have.
  • numcols - The number of columns the table should have.

deleteRow(nameOrIndex)None:

Delete a single row at the specified row name or index.

  • nameOrIndex - May be a string for a row name, or numeric index for rowindex.

appendRow(vals, nameOrIndex, sort=None)int:

Append a row to the end of the table, or after the specified row name/index. Returns the integer index of the new row.

  • vals - (Optional) If specified, will fill the row with the given values. It should be a list of items that can be expressed as strings. Each item will be copied to one cell.
  • nameOrIndex - (Optional) If specified will determine where the new row will be appended. If it's a numeric value it represents the numeric index of the row. If it is a string it represents a row label.
  • sort - (Keyword, Optional) If specified will determine the column to keep sorted after the insertion. If it's a numeric value it represents the numeric index of the column. If it is a string it represents a column label.
n.appendRow()
n.appendRow( [1,2,3], 'January' )  #append with values (1,2,3) after the row labelled 'January'
n.appendRow( [1,2,3], 5 )  #append row with values (1,2,3) after the row 5.
n.appendRow( [1,2,3], sort='Month' )  #append row with values (1,2,3) keeping column 'Month' sorted.

cell(rowNameOrIndex, colNameOrIndex, caseSensitive=True)td.Cell or None:

Find a single cell in the table, or None if none are found.

  • rowNameOrIndex/colNameOrIndex - If a string it specifies a row/column name. If it's numeric it specifies a row/column index. Pattern Matching is supported for strings.
  • caseSensitive - (Optional) Specifies whether or not case sensitivity is used.

<sytaxhighlight lang=python> c = n.cell(5, 'June') #Return a cell under row 5, column 'June'. c = n.cell('A*', 2) #Find a cell under any row beginning with an A, in column 2.

</syntaxhighlight>

copy(DAT)None:

Copy the text or table from the specified DAT operator.

  • OP - The DAT operator whose contents should be copied into the DAT.

run(arg1, arg2..., endFrame=False, fromOP=None, group=None, delayFrames=0, delayMilliSeconds=0, delayRef=me)td.Run:

Run the contents of the DAT as a script, returning a Run object which can be used to optionally modify its execution.

  • arg - (Optional) Arguments that will be made available to the script in a local tuple named args.
  • endFrame - (Keyword, Optional) If set to True, the execution will be delayed until the end of the current frame.
  • fromOP - (Keyword, Optional) Specifies an optional operator from which the execution will be run relative to.
  • group - (Keyword, Optional) Can be used to specify a group label string. This label can then be used with the td.runs object to modify its execution.
  • delayFrames - (Keyword, Optional) Can be used to delay the execution a specific amount of frames.
  • delayMilliSeconds - (Keyword, Optional) Can be used to delay the execution a specific amount of milliseconds. This value is rounded to the nearest frame.
  • delayRef - (Keyword, Optional) Specifies an optional operator from which the delay time is derived.

insertRow(vals, nameOrIndex, sort=None)int:

Insert a row to the beginning of the table or before the specified row name/index. See DAT.appendRow() for similar usage.

TouchDesigner Build:

An Operator Family that manipulates text strings: multi-line text or tables. Multi-line text is often a command Script, but can be any multi-line text. Tables are rows and columns of cells, each containing a text string.

Matching strings using wildcard characters and bracketing. Useful in "Select" parameters to select multiple operators, paths, etc.

Matching strings using wildcard characters and bracketing. Useful in "Select" parameters to select multiple operators, paths, etc.