So, I have a switch function which should calculate drink dilution based on whether it's shaken or stirred. However, regardless of what the prep method is set to, it outputs the default 0. Any ideas?
var initial_abv = field("Initial ABV")/100;
var prep_method = field("Prep Method");
switch (prep_method) {
case 'Shake':
case 'Dry Shake, Shake':
-1.567 * Math.pow(initial_abv, 2) + 1.742 * initial_abv + 0.203;
break;
case 'Stir':
-1.21 * Math.pow(initial_abv, 2) + 1.246 * initial_abv + 0.145;
break;
default: 0;
}
var initial_abv = field("Initial ABV")/100;
var prep_method = field("Prep Method");
switch (prep_method[0].field("Name")) {
var initial_abv = field("Initial ABV")/100;
var prep_method = field("Prep Method")[0..n-1].field("Name");