Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-23-2013, 07:29 AM   #1
Philantrop
Addict
Philantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beauty
 
Philantrop's Avatar
 
Posts: 228
Karma: 32001
Join Date: Dec 2008
Device: iOS devices
Custom yes/no column built from long text column

I have a custom column "foo" of type "Long text, like comments, not shown in the tag browser" which either contains nothing at all or some text.

I'd like to have a simple "Yes/No" column "bar" that, in the library view, shows if "foo" contains anything.

So I added said "Yes/No" column of type "Column built from other columns" and used this template:

program: test(select(field('#annotations'),'.*'),'Yes ','No')

Unfortunately, this function always returns "No". Even when replacing the '.*' with 'e' (because I had prepared "foo"'s content to contain it), it still returned "No".

I've experimented with just using test() but whatever I tried, it simply either returned "Yes" or "No" for *all* entries, regardless of "foo"'s actual content.

Can someone please lend me a hand here? :)
Philantrop is offline   Reply With Quote
Old 03-23-2013, 10:17 AM   #2
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,126
Karma: 5468860
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Philantrop View Post
I have a custom column "foo" of type "Long text, like comments, not shown in the tag browser" which either contains nothing at all or some text.

I'd like to have a simple "Yes/No" column "bar" that, in the library view, shows if "foo" contains anything.

So I added said "Yes/No" column of type "Column built from other columns" and used this template:

program: test(select(field('#annotations'),'.*'),'Yes ','No')

Unfortunately, this function always returns "No". Even when replacing the '.*' with 'e' (because I had prepared "foo"'s content to contain it), it still returned "No".

I've experimented with just using test() but whatever I tried, it simply either returned "Yes" or "No" for *all* entries, regardless of "foo"'s actual content.

Can someone please lend me a hand here?
Have you tried to flip the logic (Not an empty string. those are 2 ' not a double quote)?
Code:
program: test(select(field('#annotations'),''),'No','Yes')
theducks is offline   Reply With Quote
 
Enthusiast
Old 03-23-2013, 10:24 AM   #3
Philantrop
Addict
Philantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beauty
 
Philantrop's Avatar
 
Posts: 228
Karma: 32001
Join Date: Dec 2008
Device: iOS devices
Quote:
Originally Posted by theducks View Post
Have you tried to flip the logic (Not an empty string. those are 2 ' not a double quote)?
Code:
program: test(select(field('#annotations'),''),'No','Yes')
Yes, indeed, I've tried that, too (and just did again with 0.9.24 just to make sure), and that only serves to invert the display (before, everything was "No", now everything is "Yes") but doesn't fix the issue.
Philantrop is offline   Reply With Quote
Old 03-23-2013, 10:34 AM   #4
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,126
Karma: 5468860
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Philantrop View Post
Yes, indeed, I've tried that, too (and just did again with 0.9.24 just to make sure), and that only serves to invert the display (before, everything was "No", now everything is "Yes") but doesn't fix the issue.
I am not that good with program mode (OK, I am pretty lousy ). Inverting the logic (not foo:true) has worked in other places, which is why I tossed it into the pot.
chaley will be around pretty soon and probably point to the error of our ways
theducks is offline   Reply With Quote
Old 03-23-2013, 06:56 PM   #5
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 4,929
Karma: 802238
Join Date: Jan 2010
Location: France
Device: Many android devices
Why are you using field ('#annotations') instead of field ('#foo')?
chaley is offline   Reply With Quote
Old 03-23-2013, 07:21 PM   #6
Philantrop
Addict
Philantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beauty
 
Philantrop's Avatar
 
Posts: 228
Karma: 32001
Join Date: Dec 2008
Device: iOS devices
Quote:
Originally Posted by chaley View Post
Why are you using field ('#annotations') instead of field ('#foo')?
Because that's the field's actual name which I forgot to replace. foo=annotations.
Philantrop is offline   Reply With Quote
Old 03-23-2013, 07:28 PM   #7
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 4,929
Karma: 802238
Join Date: Jan 2010
Location: France
Device: Many android devices
You almost certainly don't want the function select, which operates on lists of colon separated items. You probably want the function contains, which operates on plain text. The regexp for contains would be something like . (a period), testing if the field contains at least one character.
chaley is offline   Reply With Quote
Old 03-23-2013, 07:44 PM   #8
Philantrop
Addict
Philantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beautyPhilantrop does all things with Zen-like beauty
 
Philantrop's Avatar
 
Posts: 228
Karma: 32001
Join Date: Dec 2008
Device: iOS devices
Quote:
Originally Posted by chaley View Post
You almost certainly don't want the function select, which operates on lists of colon separated items. You probably want the function contains, which operates on plain text. The regexp for contains would be something like . (a period), testing if the field contains at least one character.
Thank you, that was exactly the nudge into the right direction I needed. :-)

So, the solution to my problem as initially described is rather simple:

program: contains(field('#foo'),'.','Yes','No')
Philantrop is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to move value(s) of tag column to a custom made column zoorakhan Library Management 0 12-08-2012 03:53 AM
custom date column from two state column Dopedangel Library Management 7 01-03-2012 08:20 AM
No search/replace on custom long text column? CWatkinsNash Library Management 2 06-20-2011 05:57 PM
Converting text for a datetime custom column kiwidude Development 2 02-26-2011 10:47 AM
Custom text column with no HTML mfaine Calibre 2 01-07-2011 01:12 PM


All times are GMT -4. The time now is 08:25 PM.


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