PRE-REQUISITES

For the following code examples to work, you will need to add Fliplet’s Data Sources API to your app. To add it follow the steps referenced here.

To remove an entry (i.e. a row in the data source) you need to know that entry’s ID. You can find the entry’s ID (in this case we’re locating a row where the name is “John”) and delete the row using the .removeById() command.

var dataSourceConnection;

Fliplet.DataSources.connect(265)
  .then(function (connection) {
    dataSourceConnection = connection;

    return connection.findOne({
      where: { name: 'John' }
    });
  })
  .then(function (user) {
    if (!user) {
      return Promise.reject('User not found');
    }

    return dataSourceConnection.removeById(user.id);
  });

If you don’t want to delete the entire row but instead want to delete a value in the row, this is equivalent to updating a column with a blank value. For examples on how to save and overwrite data in the data source please go here.

Was this article helpful?
YesNo