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 04-28-2024, 02:29 PM   #1
marshie250
Enthusiast
marshie250 began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Jun 2019
Device: Kobo
date_arithmetic using a field instead of a set number

In Calibre, I have a custom column that predicts how many days it will take to finish a book based on my wpm and the word count of the book. I would love to have a secondary column that predicts the finish date of the book. The date_arithmetic function is close to what I need, I think, and would look something like this (perhaps?):

program:
date_arithmetic(today(),field('#completiondate')d)


where field('#completiondate') is my column that predicts how many days it would take to finish the novel. However, I don't think date_arithmetic works with a variable field instead of a set number increase. (or if it does, I am unsure where to put the single quotes) Does anyone know a way to accomplish this?
marshie250 is offline   Reply With Quote
Old 04-28-2024, 03:13 PM   #2
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: 8,722
Karma: 62000001
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I tried it with this (substituting one of my own datetime columns):

Code:
program:

days = days_between(today(),$$#kobodate);

date_arithmetic(today(),days)
Unfortunately it got me a Invalid calculation specifier error.
ownedbycats is online now   Reply With Quote
Old 04-28-2024, 03:49 PM   #3
marshie250
Enthusiast
marshie250 began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Jun 2019
Device: Kobo
I should have been more specific:
field('#completiondate') is an integer (calculated from word count/average words read per day), not a date (poor naming on my part)

date_arithmetic asks for an integer followed by a specification, like '1d' for add one day. I'm looking for a way to make that integer be pulled from a separate column, which is populated with an integer, and add that to today's date.

For example, the field('#completiondate') predicts that I could finish the novel in 5 days. This column would ideally add five days to today's date, and display it as the predicted finish date.

This is more something I've been tinkering around with just to see if it could be done than something I need for any reason, but I'm invested in seeing if there is a solution now that I can use as a springboard for some other ideas for columns I have.
marshie250 is offline   Reply With Quote
Old 04-28-2024, 04:08 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: 8,722
Karma: 62000001
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Does this do what you want?

Code:
program:

mynum = strcat($$#completiondate, 'd');

date_arithmetic(today(),mynum)
EDIT: This'll probably fall over if you have nothing in completiondate, an if-then should help:

Code:
program:

	if 
		!$$#completiondate
	then ''

	else 
		mynum = strcat($$#completiondate, 'd');
		date_arithmetic(today(),mynum)
	fi

Last edited by ownedbycats; 04-28-2024 at 04:13 PM.
ownedbycats is online now   Reply With Quote
Old 04-28-2024, 06:30 PM   #5
marshie250
Enthusiast
marshie250 began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Jun 2019
Device: Kobo
That did it! I had to round the completion date number, but that was simple, so thank you!!!
marshie250 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Row number delete / set back csocsotibi Library Management 3 09-12-2022 04:14 AM
How to set the number of decimals in a custom column sekhemty Library Management 3 04-28-2017 09:06 AM
Is it possible to set a hierarchy on the series field? sekhemty Library Management 2 02-05-2017 09:27 AM
set metadata field fr3d Library Management 6 06-14-2012 11:25 AM
ZXreader series field - how do I set it using Calibre? Boreads Calibre 3 12-08-2010 11:38 PM


All times are GMT -4. The time now is 06:16 PM.


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