Home > Contents > Index >
CATALOGMANAGER.replacerows
Replaces multiple rows in a table using the
CATALOGMANAGER
command.
Note
errno
is not set. No error is generated if the value for a particular column is invalid (for example, enter a text character into an integer type field). Valid column edits succeed, invalid column edits do not. We recommend that you check your input carefully.Syntax
<CATALOGMANAGER>
<ARGUMENT NAME="ftcmd" VALUE="replacerows"/> <ARGUMENT NAME="tablename" VALUE="table"/> [<ARGUMENT NAME="</CATALOGMANAGER>primarykey
N" VALUE="some value"/>] [<ARGUMENT NAME="columnnameN" VALUE="column name"/>] [<ARGUMENT NAME="urlcolumnname_folderN" VALUE="folder name"/>] [<ARGUMENT NAME="columnname_fileN" VALUE="file name"/>] [<ARGUMENT NAME="tablekeyN" VALUE="column name"/>] [<ARGUMENT NAME="tablekeyvalueN" VALUE="some value"/>]Parameters
ftcmd (required)
- Value must be set to
replacerows
.
tablename (required)
- Name of the table that contains the rows to replace.
primarykeyN (optional)
- Value of row's primary key. The
primarykey
parameter is the primary key's column name. The value ofN
corresponds to the row number--in the resultset--that you want to replace.
columnnameN (optional)
- Each column in the row to be replaced.
columnname
is a table column name. The value ofN
corresponds to the row number--in the resultset--that you want to replace.
urlcolumnname_folderN (optional)
- A subfolder name to store the uploaded file. The file is then stored under the upload folder and the subfolder. The upload folder is specified in the SystemInfo table's
defdir
column. Note that you can have multiple upload columns.
- Upload columns are designated by the prefix
url
. The column name in the table must begin withurl
(for example,urltext
). The argument name must include the table's column name with_folder
appended to the column name (for example,urltext_folder
).
columnname_fileN (required for non-binary files)
- The name of the file you want to upload. The column name in the table must begin with
url
(for example,urltext
). The argument name must have_file
appended to the table's column name (for example,urltext_file
).
tablekeyN (optional)
- Use the
tablekeyN
parameter if you want to update rows based on a value other than the primary key. The value oftablekeyN
is the column name of the column you use to perform the update. The value ofN
corresponds to the row number--in the resultset--that you want to update. For example, if you want to update a table based on the value in thetitle
column, thetablekeyN
parameter looks as follows:
inList.setValString("tablekey0", "title")tablekeyvalueN (optional)
- Value in the
tablekey
column of the row you want to update. The value ofN
corresponds to the row number--in the resultset--that you want to update. For example, if you want to update a row with a value ofJaws
in thetitle
column, thetablekeyvalueN
parameter looks as follows:
inList.setValString("tablekeyvalue0", "Jaws")- This parameter is required only if the
tablekey
parameter is used.
Description
The
replacerows
command replaces multiple rows in a table. If a value is not specified for a column, the column value is cleared.
Note
If the row specified by the primary key value does not exist, then the row is added to the table.
errno
The possible values of
errno
include:
Value Description -22 Table already exists. -103 No such table. -104 No table definition. -105 Database error.Example
The following example updates a row and adds a new row to the table named
movies
:
24 Something About MaryR
25 The GodfatherPG
<SETVAR NAME="errno" VALUE="0" /> <CATALOGMANAGER> <ARGUMENT NAME="ftcmd" VALUE="replacerows" /> <ARGUMENT NAME="tablename" VALUE="movies" /> <ARGUMENT NAME="id0" VALUE="26" /> <ARGUMENT NAME="title0" VALUE="American Pie" /> <ARGUMENT NAME="rating0" VALUE="R"/> <ARGUMENT NAME="id1" VALUE="25" /> <ARGUMENT NAME="title1" VALUE="The Godfather"/> </CATALOGMANAGER> <IF COND="IsError.Variables.errno=true"> <THEN> <!--Handle error--> </THEN> </IF>The new row is displayed in the following table, and the rating row of the GodFather is changed to null:
24
Something About Mary R25
The Godfather26
American Pie RSee Also
Home > Contents > Index > ![]()
FatWire XML Tag Reference
Copyright 2005 by FatWire Software
All rights reserved.