08-19-2012, 03:15 PM | #1 |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2012
Device: Nexus 7
|
Syntax for nesting functions in program mode
Hi, I'm trying to create a Save to Disk template that will modify author_sort in two ways:
1) Return only the first author 2) Remove any periods (so that they aren't converted to underscores). For example, given a book with authors Philip K. Dick & Roger Zelazny I want to return Dick, Philip K I have each modification working on it's own in single-function mode: 1) {author_sort:re(\.,)} returns Dick, Philip K & Zelazny, Roger 2) {author_sort:sublist(0,1,&)} returns Dick, Philip K_ But I'm having trouble with the syntax for nesting the re() and sublist() functions to make them work together. I've tried a lot of variations along the lines of: {author_sort:'sublist(re($,\.,),0,1,&)'} or {author_sort:'re(sublist($,0,1,&),\.,)'} But I always get Invalid Input or Incorrect Number of Arguments errors. I'm not very familiar with the syntax, so I know that I don't really know when I need to escape characters or add whitespace, whether the nesting order matters, etc. Any ideas what I'm doing wrong? |
08-19-2012, 05:31 PM | #2 |
Grand Sorcerer
Posts: 11,866
Karma: 7036359
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You must choose one of single-function mode, template program mode, or general program mode. The syntax is different for each of the three.
For example, your template Code:
{author_sort:'sublist(re($,\.,),0,1,&)'} or {author_sort:'re(sublist($,0,1,&),\.,)'} Code:
{author_sort:'sublist(re($, '\.', ''),0,1,'&')'} Code:
{author_sort:'re(sublist($,0,1,'&'), '\.', '')'} Last edited by chaley; 08-20-2012 at 03:16 AM. |
Advert | |
|
08-20-2012, 02:26 AM | #3 |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2012
Device: Nexus 7
|
That worked perfectly! That's a lot for the quick info.
|
Tags |
nesting, strip, template |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
syntax tags | MMAC | Library Management | 1 | 02-29-2012 03:51 PM |
Help with plugboard syntax, please | Ptarmigan | Library Management | 3 | 02-15-2012 05:44 AM |
Request Safe mode or recovery mode for Pocket Edge? | felixblackcat | enTourage eDGe | 25 | 01-08-2012 05:07 PM |
Does anyone use "general program mode" template functions? | chaley | Library Management | 0 | 08-16-2011 11:54 AM |
Help with search syntax please. | rwelbourn | Library Management | 3 | 04-16-2011 02:07 AM |