http://www.eobjects.dk/datacleaner/IconUserGuide.png

Validation Rule: Javascript evaluation

back to DataCleaner | back to DataCleanerUserGuide

The Javascript evaluation rule uses a user-written javascript to validate values in a row. A special javascript variable values represents the row that is currently being evaluated and values in the row can be fetched by using the get(columnName) method.

Check out  w3schools for an in-depth javascript reference.

Example

Given this table:

NAME TITLE COUNTRY
Kasper Founder & Developer Denmark
Johny Developer Israel
Asbjørn Developer Denmark

A javascript to confirm that the word "Developer" exists in the "Title" column could be written as:

var title = values.get("TITLE");
title != null && title.indexOf("Developer") > -1;

Notice the way that values.get("TITLE") retrieves the contents of the title column. We could also compare two columns by retrieving them both:

var name = values.get("NAME");
var title = values.get("TITLE");
if (name == "Kasper") {
 title == "Founder & Developer";
} else {
 title == "Developer";
}