If / then / else statements

One of the functions you can perform in Trevor is called an 'if / then / else' statement (Also known as CASE if you're familiar with SQL). To do this you need to:

  1. Click 'columns' and add a new column.
  2. Click the cheat sheet to access the formula - or use this one: if (my_column == "XYZ" and my_column2 == "ABC") then "1" else "0". 
  3. Replace the sections in Italics (my_column, XYZ, my_column2, ABC, 1, 0) with what you want to achieve. In the example in the video below, I want to get a new column with Ford Focus reservations vs other make and model reservations so my formula looks like: if (c.make == "Ford" and c.model == "Focus") then "Ford Focus" else "Other Makes"
  4. Hit done and you will see a new column appear with the results. 
  5. If you want to count your results vs other results, click the column header and select summarize -> count.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.