From RPM Wiki
| Table of contents |
[edit]
Summary
API: Add to or replace the data inside a form worksheet table.
[edit]
Request
- You need to identify the form worksheet table by TableID.
- In addition, are options for how rows are handled.
- Finally, the data must be included.
By form ID and worksheet ID.
{
"Key":"{api key}",
"TableID":"{table id}",
"RowOverwrite":{true/false}, (optional, see below)
"Data":[
{
"Value":"{the data value}",
"ColID":"{column ID}", (see below)
"ColIndex":"{column position starting with 0}",
"Row":"{row position starting with 0}"
]
}
[edit]
RowOverwrite
- True: Replace existing data. Clear any existing table data first then add the new data using the rows as specified.
- False: Add new rows leaving existing data intact. Translate the rows specified by adding the highest existing row number to them (and an additional +1).
- Example: There is existing data with a row of 4. That means in the data specified in the API request, row 0 becomes row 5 so that the first row of new data is added below the last row of existing data.
- Default
[edit]
ColID vs ColIndex
- Each data object requires a ColID integer or a ColIndex integer.
- ColIndex allows the user to specify a column by the order they appear. The API will then automatically replace that with the appropriate ColID before saving. This lets a user fill in data just by column position instead of having to know the column IDs.
- If both are non-zero then use ColID. Since not including the property is the same as specifying zero, and there is never an ID of zero, the rule is that if the ColID is zero/null then look at the ColIndex.
- If both are zero/null that is fine as it would result in a valid ColIndex of zero.
[edit]
Example
http://demo.rpmsoftware.com/rpm/Api.svc/ProcFormWorksheetTableAdd
{
"Key":"abc123def456",
"TableID":"991",
"Data":[
{
"Value":"Hello World!",
"ColIndex":0,
"Row":0
}
]
}
[edit]
Response
Use the response from Api/ProcFormWorksheet
- Returns the whole worksheet, not just the new table
[edit]
Errors
- "Table not found"
- "Permission denied"
- "Duplicate cells"
- This means that 2 or more of the data objects refer to the same cell location
- "Column not found"
- ColID is non-zero and does not exist in that table, or
- ColIndex is too high (not that many columns), or
- "Column is fixed"
- One or more data objects is trying to write to a fixed column
- "Invalid value"
- The value of 1 or more data types can not be put into that column type.
[edit]
History
- Greenman: Feature added
- This page was last modified 16:36, 12 Feb 2010.
- This page has been accessed 504 times.
