View Single Post
Old 12-14-2011, 04:17 PM   #185
jvan
Junior Member
jvan began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Dec 2011
Device: kindle
Quote:
Originally Posted by Man Eating Duck View Post
You're on the right track. This is not very elegant, but it works:

My words column is named, originally enough, #words. I add a custom column as follows:

Lookup: words1000

Column heading: 1000 words

Type: Column built from other columns

Template: {#words:'re(divide($,1000),'\..*','')'}

This gives you a plain number of thousands. Since the float is truncated by a regular expression you can add whatever suffix you want, for instance to get 100K you'd replace '\..*','' above with '\..*','K' or '\..*',' thousands'.

If you want a prefix it's also possible by using the re() function as an argument in a strcat.

Good luck
I'm not able to get the template to divide the word count by 1000 to work. The word count column is fine but the "1000 words" column displays:

TEMPLATE ERROR invalid literal for float():

I'm using the same lookup names as the example. Is there something else that needs to be installed to use these templates or the re() function?

Last edited by jvan; 12-14-2011 at 04:24 PM.
jvan is offline   Reply With Quote