Data API Methods

The Data API handles calls related to the main data body of the case.

This API handles adding, removing, or modifying alternatives; retrieving comments and likes for rows; and handling comments for parameters.

Column creation and deletion are covered by the Parameter API.

This page discusses:

addRow(String dataSet, String dataSetType, String dataSetAlias, Dictionary values)

This method adds a single row to the data set.

Arguments
  • dataSet: The name of the parent Data Set containing the new row. Defaults to "User Created".
  • dataSetType: The type of the parent Data set. Defaults to "User Created Data".
  • dataSetAlias: The alias of the parent Data Set. Defaults to "USER_CREATED".
  • values: A dictionary-like object mapping parameter IDs to values for the newly created row.
All variables are optional.

addRows(Integer numRows, String dataSet, String dataSetType, String dataSetAlias)

This method adds one or more rows to the data set.

This is functionally similar to addRow(), but it adds multiple rows and does not set values.

Arguments
  • numRows: The number of rows to be added. Defaults to 1.
  • dataSet: The parent Data Set to which the new rows will be added. Defaults to "User Created".
  • dataSetType: The parent Data Set type. Defaults to "User created data".
  • dataSetAlias: The parent Data Set alias. Defaults to "USER_CREATED".
Return Value
Returns a list-like object containing the rowIDs of the newly created rows.

deleteRows(List rowIds)

This method deletes specified rows.

Arguments
rowIds: A list-like object containing the row ID values identifying the rows to be deleted.
Return Value
None.
You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods.

excludeRows(List rowIds)

This method excludes specified rows.

Arguments
rowIds: A list-like object containing the rowID values identifying the rows to be excluded.
Return Value
Returns a list-like object containing the IDs of the newly included rows. This list does not include the IDs of any rows that were already included.
You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods.

includeRows(List rowIds)

This method includes specified rows.

Arguments
rowIds: A list-like object containing the rowID values identifying the rows to be included.
Return Value
Returns a list-like object containing the IDs of the newly included rows. This list does not include the IDs of any rows that were already included.
You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods.

setValues(Dictionary valuesJson)

This method sets values specified by row and column IDs.

Arguments
  • valuesJson: A nested dictionary-like object in which parameter IDs are keyed to subdictionaries in which row IDs are keyed to the values to be set.
  • valuesJson schema. For more information, see setValues Schema.
Return Value
None.
You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods. ParameterIDs are obtained through the Parameter API.

getValues(List<String> paramIds, List<Integer> rowIds)

This method gets values specified by row and column IDs.

Arguments
  • paramIds: A list of strings identifying one or more parameters for which values should be retrieved. Defaults to all parameters.
  • rowIds: A list of integers identifying one or more rows for which values should be retrieved. Defaults to all rows.
Return Value
Returns a nested dictionary, with parameterID strings keyed to subdictionaries in which rowID integers are keyed to cell values.
paramIds values correspond to the id attribute on the parameter objects returned; for example, by the select method in the Parameter API.

rowIds are the corresponding integer values for rows.

select(Callable selector)

This method returns all rows matching a given selector.

Arguments
selector: A Python callable object
Return Value
Returns a list-like Python object containing all values matching the selector.
The selector is passed each row in the data set. The rows are formatted as dictionary-like objects with all non-parameter values (such as IDs) defined as entries in the row object and all parameter values stored in a subdictionary corresponding to the key values on the row object. The following example selects all rows for which the column with cementParamId has no defined value:
def nullCementTest(row):
    return row["values"][cementParam()["ID"]] == None

emptyRows = DataAPI.select(nullCementTest)

getParameterValues(String paramId)

This method returns all values for a specified parameter.

Arguments
paramId: A string identifying a parameter.
Return Value
Returns a list-like object containing all values for a specified parameter.
The paramId argument corresponds to the ID entry in the dictionaries returned by the select() or next() methods in the Parameter API.

setRowName(Integer rowId, String rowName)

This method sets the display name of a row.

Arguments
rowId: An integer identifying a row.
rowName: A string labeling the row.
Return Value
None.

getRowComments(Integer rowId)

This method returns an array containing all comments for a specified row.

Arguments
rowId: An integer identifying a row.
Return Value
Returns a list-like object containing all comments for a specified row.

addComment(Integer rowId, String text)

This method adds a comment to a row.

Arguments
  • rowId: An integer identifying the row to which the comment will be added.
  • text: The text content of the comment to be added.
Return Value
Returns a dictionary-like object corresponding to the newly added comment.

addReply(Integer rowId, String text)

This method adds a reply to a comment or a reply on a row.

Arguments
  • rowId: An integer identifying the row to which the comment will be added.
  • text: The text content of the comment to be added.
  • parentId: The parent comment to which a comment will be added under, if the comment is a subcomment. If no parentId value is provided, the comment will be a comment directly on the row.
Return Value
Returns a dictionary-like object corresponding to the newly added comment.
parentId corresponds to the id attribute on the comment objects returned by a call such as getCommentsForRow(). The method searches all comments and subcomments under the specified row for an id attribute matching parentId, to which the new comment is appended.

removeComment(Integer rowId, String commentId)

This method removes a comment or reply.

Arguments
  • rowId: An integer describing the row under which the comment exists.
  • commentId: A string identifying the comment to be removed.
Return Value
Returns a list-like object containing all remaining comments on the row to which the removed comment was previously attached.
The removeCommentForRow method can be used to remove either comments or subcomments.

You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods. You can obtain commentId values when creating a new comment or when retrieving all comments associated with a specific row.

getLikesForRow(Integer rowId)

This method returns an array of likes for a specified row.

Arguments
rowId: An integer identifying a row.
Return Value
Returns a list-like object containing all 'like' objects associated with a specified row.
You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods.

addLikeForRow(Integer rowId)

This method adds a like for a specified row.

Arguments
rowId: An integer identifying a row.
Return Value
Returns a list-like object containing all likes for the specified row.
You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods.

removeLikeForRow(Integer rowId)

This method removes a like for a specified row.

Arguments
rowId: An integer identifying a row.
Return Value
Returns a list-like object containing all remaining likes for the specified row.
You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods.

addLikeForComment(Integer rowId, String commentId)

This method adds a like for a specified comment on a specified row.

Arguments
  • rowId: An integer identifying the row for which the comment has been defined.
  • commentId: A string identifying the comment.
Return Value
Returns a list-like object containing all likes for the specified comment.
The addLikeForRowComment method can be used to add likes for either comments or subcomments.

You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods.

You can obtain commentId values when creating a new comment or when retrieving all comments associated with a specific row.

removeLikeForComment(Integer rowId, String commentId)

This method removes a like for a specified comment on a specified row. You can do this for comments or subcomments.

Arguments
  • rowId: An integer identifying the row for which the comment has been defined.
  • commentId: A string identifying the comment.
Return Value
Returns a list-like object containing all remaining likes for the specified comment.
The removeLikeForRowComment method can be used to remove likes for either comments or subcomments. You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods. You can obtain commentId values when creating a new comment or when retrieving all comments associated with a specific row.

getLikesForComment(Dictionary commentDict)

This method returns a list of likes for a specified comment on a specified row. You can do this for comments or subcomments.

Arguments
  • rowId: An integer identifying the row for which the comment has been defined.
  • commentId: A string identifying the comment.
Return Value
Returns a list-like object containing all likes for the specified comment.
The getLikesForRowComment method can be used to get likes for either comments or subcomments.

You can obtain rowID values when creating a new row or from the row objects returned by the select() and next() methods.

You can obtain commentId values when creating a new comment or when retrieving all comments associated with a specific row.

getRowIterator()

This method creates a new iterator for the set of all rows.

Arguments
None.
Return Value
Returns a string used to uniquely identify the newly generated iterator.

hasNext(String iteratorId)

This method returns true if an iterator has at least one more item.

Arguments
iteratorId: The ID string returned by the getIterator method
Return Value
Returns true if the iterator has at least one more item.

next(String iteratorId)

This method returns the next value for a given iterator, if one exists.

Arguments
iteratorId: The ID string returned by the getIterator method
Return Value
Returns a JSON-like object describing the next row in the iterator. Returns an error if all rows have been retrieved.

setBasketRowIdList(List rowIds)

This method sets the basket to a specified list of row IDs.

Arguments
rowIds: A list of integers defining the basket.
Return Value
Returns a list of integers describing all rows in the basket.

addRowsToBasket(List rowIds)

This method adds all items in the specified rowIds list that are not already in the basket to the basket.

Arguments
rowIds: A list of row IDs to add to the basket.
Return Value
Returns a list of integers describing all rows in the basket.

removeRowsFromBasket(List rowIds)

This method removes specified row IDs from the basket.

Arguments
rowIds: A list of integers to remove from the basket.
Return Value
Returns a list of integers describing all rows in the basket.

getBasketRowIdList()

This method gets the current basket contents.

Arguments
None.
Return Value
Returns a list of integers describing all rows in the basket.

toggleRecommendedRow(Integer rowId)

This method changes whether the status of the specified row is recommended or not.

Arguments
rowId: The ID of the row to be toggled.
Return Value
Returns a list of integers describing all rows that are recommended.

getRecommendedRowIdList()

This method gets the current recommended rows.

Arguments
None.
Return Value
Returns a list of integers describing all rows that are recommended.

setBackgroundInfo(String info)

This method sets the background information field for the analytics case.

Arguments
info: A string containing the background information for the case.
Return Value
Returns the updated case background information.

getBackgroundInfo()

This method gets the background information field for the case.

Arguments
None.
Return Value
Returns the case background information.

setMethodsInfo(String info)

This method sets the methods information field for the analytics case.

Arguments
info: String containing the methods information for the case.
Return Value
Returns the updated case methods information.

getMethodsInfo()

This method gets the methods information field for the analytics case.

Arguments
None.
Return Value
Returns the case methods information.

getCaseInfo()

This method gets the case information object for the analytics case.

Arguments
None.
Return Value
Returns the case information object describing the case. This contains methods and background, among other fields.

setGradingMethod(String gradingMethod)

This method sets the grading method for the analytics case.

Arguments
gradingMethod: A string identifying which grading method should be used for the case. Possible values are TOPSIS and WEIGHTED_SUM.
Return Value
Returns the grading method for the analytics case.

getGradingMethod()

This method gets the grading method for the analytics case.

Arguments
None.
Return Value
Returns the grading method for the analytics case.