Quote:
Originally Posted by ownedbycats
On this topic:
Code:
program:
if raw_field('#percentread') ==# '0' then '1'
else raw_field('#percentread')
fi
Running this on a book with #percentread undefined returns result as 1.What is the proper way to make it remain undefined?
I changed it to raw_field('#percentread', '1') and it remained undefined but that felt kludge. Empty string '' returned a 1 not sure why.
|
Here is what I would do.
Code:
program:
v = raw_field('#myint', '');
if !v then
''
elif v ==# 0 then
'1'
else
v
fi
This is the same thing but not using the second parameter of raw_field.
Code:
program:
v = raw_field('#myint');
if v == 'none' then
''
elif v ==# 0 then
'1'
else
v
fi