View Single Post
Old 12-27-2022, 04:38 AM   #9
Lys
Groupie
Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.
 
Posts: 182
Karma: 727278
Join Date: Dec 2022
Location: Not in an English speaking country
Device: (Too many) Kobo(s)
Quote:
Originally Posted by Fynjisx View Post
can you elaborate on how it works?
With the usual caveat that I'm in no way a template language expert and I got the basis of that template thanks to other members here on MR:

#percent_read is the column where I store the % and it's referred inside the formula as $
cmp(x, y, lt, eq, gt) is a the function that compares x to y (after converting them to number) and returns lt value if x<y, eq value if x=y, and gt value if x>y

My formula basically means: compare the percent read column value ($) to 100.
Code:
#percent_read:'cmp($, 100,
If the percent read is minor to 100, compare again its value to 0 and if it's minor to 0 set the column value as "DNF", if it's equal to 0 leave it blank, if it's greater to 0 set it as "Reading".

Code:
cmp($, 0, 'DNF', '', 'Reading')
if the first comparison to 100 returns "equal", set the value of the composite column as "Finished". If it's greater than 100 leave it blank.
Lys is offline   Reply With Quote