Thread: Column Creation
View Single Post
Old 06-11-2011, 02:20 PM   #14
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,461
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
try
Code:
program:
t = field('#award');
first_non_empty(
	test(and(contains(t, 'Hugo win', '1', ''),
			contains(t, 'Nebula nom', '1', '')),
		'chocolate', ''),
	test(and(contains(t, 'Hugo nom', '1', ''),
			contains(t, 'Nebula win', '1', '')),
		'chocolate', ''),
	test(or(contains(t, 'Hugo win', '1', ''),
			contains(t, 'Nebula win', '1', '')),
		'orange', ''),
	test(or(contains(t, 'Hugo nom', '1', ''),
			contains(t, 'Nebula nom', '1', '')),
		'goldenrod', ''),
	test(and(contains(t, 'Hugo win', '', '1'),
			contains(t, 'Nebula win', '', '1'),
			contains(t, 'win', '1', '')),
		'sandybrown', ''),
	test(and(contains(t, 'Hugo nom', '', '1'),
			contains(t, 'Nebula nom', '', '1'),
			contains(t, 'nom', '1', '')),
		'lightsalmon', '')
)
This applies the tests in order
- Hugo win and Nebula nom: chocolate
- Nebula win and Hugo nom: chocolate
- Hugo win or Nebula win: orange
- Hugo nom or Nebula nom: goldenrod
- win and not Hugo win and not Nebula win: sandybrown
- nom and not Hugo nom and not Nebula nom: lightsalmon
else not colored
chaley is offline   Reply With Quote