View Single Post
Old 02-26-2021, 08:37 AM   #7
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
If what you want is to select books where the series have the first three books, you can achieve this using the Action Chains plugin. The chain to do so is attached in this post. You just import it (Action Chains > Customize Plugin > Right click table > import > choose the attached zip file), and should have a menu entry in the action chains plugin titled "Mark series with parts 1,2,3".

This chain uses the following two templates:
  • First template runs once and stores series with the first three books in a variable called series_ok:
    Code:
    program:
        all_series = category_items('series');
        res = '';
        for series in all_series separator ':::':
            indices = from_search('series_index', strcat('series:"=', series, '"'));
            intersection = list_intersection(indices, '1.0,2.0,3.0', ',');
            if count(intersection, ',') == 3 then
                res = list_union(res, series, ' ::: ')
            fi
        rof;
        res
  • Second template runs for all books that are part of series, and if the book series is in the variable series_ok (created by the first template), it will mark the book with 'complete_series'
    Code:
    program:
        series_ok = globals(series_ok);
        series = field('series');
        if series then
            if list_intersection(series_ok, series, ':::') == series then
                'complete_series'
            else
                'missing_series'
            fi    
        fi

Note that for this to work, you need the latest version of both calibre (5.12) and Action Chains plugin (1.3.1)
Attached Files
File Type: zip chain_series.zip (948 Bytes, 154 views)
capink is offline   Reply With Quote