Sometimes it can happen that you would like to deleTE a data from your database and this action is totally possible in the CYS system. By applying a simple rule, you can delete the data from your project database and this result won’t be counting your report anymore.

Table of contents:

Column sys_respondentId

Before you start creating your rule and delete your data, it is important to understand what the column sys_respondentId is and why this column is important for your data deletion. 

For every record created in your data, the system generates a combination of letters and numbers in the column sys_respondentId and those are unique values are from every record. Since those values are unique, you can use the values from the sys_respondentId to apply your rule and in this way, you are sure that you are deleting the correct data. So look for the record in your database that you want to delete and use the respondent ID of that record as a reference in the Event based rule.

Event based rule

In the Event Based section you are able to apply rules to every record in your database. Simply define the changes you want to make within a rule, and within 5 minutes the updates will be applied to any record in your database that meets the conditions you have set.

To find the event-based rule section, you can follow the steps below:

1. Go to "Data Garden" 

2. Go to "Database"

3. On your project database click on " Edit database"

4. Go to the tab "rules" 

5. Click on "Event based rules"

To learn more about the event-based rule, please check this article.

How to build the rule

To build the rule is simple pretty simple, you just need to click om “Add rule (wizard) and another page will open for you where you need to fill in some information that you can find below:

  • Name – the name of the rule that you would like to create (e.g. delete data)
  • Description- It’s a non-mandatory field where you can type a small explanation about the rule 
  • Event type – Here you can choose between one time only or scheduled.

By choosing one time only, you will program your rule to run only one time.

By choosing scheduled, you will program your rule to run every 5 min continuously untill the moment you turn the rule on.

Note: For deleting data, you just need to choose the option “one time only”

  • Conditions - This is where you create the conditions based on the unique information from your database, such as the column sys_respondentId.

Please use the respondentid of the record that you would like to remove the data of:
As seen in the example below: IF sys_respondenId IS 0001f9b0-40f5-4d52-a965-c45733dfa08e

  • Action - Here you can choose the action that you would like the system to perform. The system gives you 3 options in a drop-down list:

  • Create or change database value – when you would like to create a value for a column to rewrite a value from a column 
  • Set records to status – when you can reset you record  status to New, Active or completed
  • Update records with risk level – Here you can reset the level risk of your record to High, medium or low risk.

To delete your data, please choose the action "Create or change database value".
Choose the column sys_versionState from the dropdown and type the number 1, which is the code that represent a TEST result.

Please have a look at the example below for a proper setup

Turn on the rule

To turn on the rule you need to go back to the rule overview screen and turn the rule to "active", and in 5 min your data will be deleted.

You don’t have to worry to turn off the rule in case of a one time only execution, because after executing the rule, the system will turn the rule off automatically.