View Single Post
Old 10-11-2011, 08:18 AM   #9
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: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Noughty View Post
I wanted to ask if it is possible to transform values when I am extracting them.
For example I am making column for favorites. I have values like "Favorite series", "Favorite titles". In the new column I'd like to have just word "series", "titles" etc. Since column name is already favorites. I have similar situation with a couple more columns.
You can do this, but it certainly adds complexity.

The following program will remove the word "favorite " from every element in the list:
Code:
program:
    list_union(
        re(list_intersection(field('tags'), 'Historical, Fantasy, Sci-Fi, Contemporary, Military', ','), 'favorite ', ''),
        re(list_intersection(field('#shelf'), 'Historical, Fantasy, Sci-Fi, Military', ','),  'favorite ', ''),
    ',')
although this example is silly because the word "favorite" does not appear in any of the lists.

You are rapidly approaching the point where you are pushing the template language beyond its limits, both in expression power and performance. A custom template function could be written that does exactly what you want and has excellent performance, but my guess is that this isn't something you are prepared to do. The other possibility is to use the 'correct' name in the original column.
chaley is offline   Reply With Quote