View Single Post
Old 08-31-2011, 11:05 AM   #135
Man Eating Duck
Addict
Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.
 
Posts: 253
Karma: 69784
Join Date: May 2006
Location: Oslo, Norway
Device: Kobo Aura, Sony PRS-650
Quote:
Originally Posted by han_32 View Post
I thought of another shortcut - set up a new column, reference to the word column data, divide by 1000 and truncate, and then hide the word column and show just the column with K-words. But I can also not figure out how to make it (I read documentation, really, but my programming foundations are non-existent and can not figure it out on my own so far). Anybody can helo?
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
Man Eating Duck is offline   Reply With Quote