View Single Post
Old 11-30-2012, 02:04 AM   #3
Jade Aislin
Groupie
Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.
 
Posts: 164
Karma: 3100
Join Date: Sep 2011
Device: Kobo Auro H2O, PRS-T1
Quote:
Originally Posted by chaley View Post
Your problem comes from confusing constants with field (column) values. The string '#chapters' is a constant. It always has the value '#chapters', which as you can see is not a number. To get the value of a metadata field you use the 'field' function. This function takes the name of the field as its first argument. This argument is normally a constant, but certainly does not need to be.
Thanks, I didn't know I had to use the 'field' function. Although the description in the reference section of the manual doesn't sound like how you described it (getting the value from the metadata field).

Quote:
Finally, if there is any chance that the #chapters field is empty (zero) then you need to test for that before doing the divide.
Although, I try to make sure that empty chapters fields get a 1, the last code you gave me works perfectly.

Thanks.
Jade Aislin is offline   Reply With Quote