View Single Post
Old 10-10-2011, 11:32 AM   #2
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
Quote:
Originally Posted by Noughty View Post
Just how to make a custom column from two columns which would extract only specific values?
Yes, it is possible. It isn't particularly easy.

One way to have the columns dynamically correct (reflect the values currently in the other two columns) is to use a composite column (a column built from other columns). These columns use the template language to construct the value. For example, the template
Code:
{#column1}, {#column2}
will construct a column from the values in the two custom columns #column1 and #column2. Unfortunately, that isn't what you want.

It is possible to extract values from columns. The problem is knowing what values to extract. If what you want to extract is a fixed set of values, then you probably can use something like:
Code:
program:
	list_union(
		list_intersection(field('#textmult'), 'val1, val2', ','), 
		list_intersection(field('#textmult'), 'val3, val4', ','), 
		',')
If you don't have a set of fixed known values, then things get much more complicated. You would need some way to identify a value, and you would probably need a custom template function to prune the list to the correct set of values.
chaley is offline   Reply With Quote