Change values for a column

1 post / 0 new
Change values for a column

Rightclick a column in edit mode and click edit colum.
Navigate to Expression tab and insert your code in the text field.

When a date show the year 1970 its often because the value is NULL, the expression below will change 1970 to "No date" in red.
if("[lastlogindate]".length > 0 ){"[lastlogindate]";} else {"<span style = color:red;>"+"Aldri vært pålogget"+"</span>";}

The example below check if the column username contains @, if it does NOT it changes the text color to red.

=eval(if("[username]".toLowerCase().indexOf("@") === -1){
"<span style = color:red;>"+"[username]"+"</span>"}else{"[username]"});

The example below check word number 3 in the column Message, if that is equal to "yes" the color changes to green, if the word is "no" it turns red. 
First word in a string is number 0, second word is number 1 etc.

=eval(if("[Message]".toLowerCase().split(" ")[2] === "yes"){
  "<span style = color:green;>"+"[Message]"+"</span>"}
else if("[Message]".toLowerCase().split(" ")[2] === "invalid"){
"<span style = color:red;>"+"[Message]"+"</span>"}

NB! All changes you do to a column is done after all other calculations, this means you cant use expressions to manipulate sorting for example.