View Single Post
Old 01-15-2023, 08:24 PM   #1012
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: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Template question: is it possible to ignore an empty variable?

I have this template to populate #percentread from the runtime chain variable "Current_Page":

Code:
program:
	totalpage = $#pagecount;
	currentpage = globals(Current_Page=1);
	newpercent = round(multiply ((currentpage / totalpage), 100));
Currently, if I leave Current_Page empty, it defaults to 1 and newpercent does math based on that.

Is there a way to instead ignore an empty variable and leave #percentread unmodified?

Last edited by ownedbycats; 01-15-2023 at 08:26 PM.
ownedbycats is offline   Reply With Quote