View Single Post
Old 08-19-2012, 03:15 PM   #1
jcallaway
Junior Member
jcallaway began at the beginning.
 
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?
jcallaway is offline   Reply With Quote