View Single Post
Old 11-26-2013, 02:51 AM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Use the following custom column, of type "column built from other columns":

Code:
program:
#	Return value of dislikes, if empty use 0.002
#	This causes multiplication by 500 if no dislikes
	dislikes_val=cmp(field("#dislikes"),1,
				0.002, field("#dislikes"), field("#dislikes"));

#	Main program -- as it is the last function,
#	it is returned as template value
	divide(field("#likes"),dislikes_val);
If you are not using custom columns called "likes" and "dislikes", you just switch out the names. All custom columns when named must start with "#", as I used in the example.

This will give you a ratio of likes/dislikes. If there are no dislikes, use likes*500 instead. This avoids giving a value of "Template Error" due to a divide by zero error.
eschwartz is offline   Reply With Quote