Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-27-2021, 09:47 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,950
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Template: Syntax error (again!)

I made this template for Action Chains' single-field edit to set #fanficstatus to "Abandoned" if it's more than two years old:

Code:
program:
d1 = raw_field('#fanficupdated')
d2 = format_date(today())

if
	and(
		field('#fanficstatus')=='In-Progress'),
		days_between(d1, d2)># 730,
		)
then
	"Abandoned"
else
	field('#fanficstatus')
fi
it returns EXCEPTION: Formatter: Syntax error - program ends before EOF near ')'.

I got a different error if I remove the first two lines after program: so I may have syntaxed the format_date wrong (I was trying to figure it out from the documentaiton and some other templates I had saved and the ones generated from column icon rules).

What did I do wrong this time?


Last edited by ownedbycats; 03-27-2021 at 09:58 PM.
ownedbycats is offline   Reply With Quote
Old 03-27-2021, 10:00 PM   #2
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,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Code:
program:
d1 = raw_field('#fanficupdated');
d2 = format_date(today(),'iso');

if
	and(
		field('#fanficstatus')=='In-Progress',
		days_between(d1, d2)># 730,
		)
then
	"Abandoned"
else
	field('#fanficstatus')
fi
You are missing some semicolons. Also you have an extra ')' after the 'In-Progress'. And format_date() is missing an argument.
capink is offline   Reply With Quote
Advert
Old 03-27-2021, 10:02 PM   #3
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,950
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thank you. I figured out the extra ) and missing ; a bit after posting but didn't realize about the iso part.

Last edited by ownedbycats; 03-27-2021 at 10:08 PM.
ownedbycats is offline   Reply With Quote
Old 03-27-2021, 10:22 PM   #4
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,950
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Edit: I am moving this to a new separate thread.

Last edited by ownedbycats; 03-28-2021 at 07:58 PM.
ownedbycats is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre Template editor syntax help beber75 Calibre 3 09-03-2020 10:38 AM
Need help in Custom Columns, template syntax, and rounding numbers dennocoil Calibre 0 07-10-2017 03:24 PM
Error message: "TEMPLATE ERROR Single '}' encountered in format string" frank14612 Calibre 22 07-02-2013 11:05 AM
Syntax Error recieved for all attempted News Fetches porterfi Calibre 3 04-06-2011 04:50 PM
Invalid Syntax Error msprang Sony Reader 7 11-07-2009 01:11 PM


All times are GMT -4. The time now is 07:46 AM.


MobileRead.com is a privately owned, operated and funded community.