|
|
#1 |
|
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,333
Karma: 79528341
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
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. |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,216
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
|
|
|
|
|
|
#3 |
|
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,333
Karma: 79528341
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. |
|
|
|
|
|
#4 |
|
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,333
Karma: 79528341
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. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
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 |