MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Library Management (https://www.mobileread.com/forums/forumdisplay.php?f=236)
-   -   Need help with composite column (https://www.mobileread.com/forums/showthread.php?t=321225)

BookJunkieLI 07-03-2019 01:00 AM

Need help with composite column
 
I currently have two columns built from other columns called Collection1 and Collection2. I use them to create collections on my Kindle but I frequently end up with a lot of duplication.

Collection1 is built from my custom columns #unread and #readinglist. Together these form the list of what I want to read next in various genres.

Collection2 is built from the custom columns #fave, #fandom, and #fandom2. These are favorite stories that I want on my kindle because I'm likely to read them again.

#fandom and #fandom2 will always have data in them. #unread, #readinglist, and #fave do not always have data in them. And therein seems to be the issue.

What I want is a collection column where if {#unread:||.}{#readinglist} has data it populates the column (ie N.Read Next Gen), if those two columns are blank then it fills in {#fave:||.}{#fandom}.{#fandom2} (ie F.Fandom.Sub-Fandom)

I tried using the first_non_empty({#unread:||.}{#readinglist},{#fave :||.}{#fandom}.{#fandom2}) but that resulted in the column reading:
first_non_empty(N.Read Next Gen,Fandom.Sub-Fandom)
or
first_non_empty(,F.Fandom.Sub-Fandom2)

I tried putting program: in front of it but that just returned a Template Error. I also tried putting If and then OR but got the same result as first_non_empty. I'm not particularly good and programming so I'm not sure what other functions I should try or if I'm just messing up the syntax.

Any help would be greatly appreciated. Thanks.

davidfor 07-03-2019 08:20 AM

I think the following will work:

Code:

program:
first_non_empty(template("[[#unread:||.]][[#readinglist:]]"),template("[[#fave:||.]][[#fandom]].[[#fandom2]]"))

I can't test it properly as I don't have the right columns.

BookJunkieLI 07-03-2019 12:42 PM

:thanks::thumbsup::thanks::iloveyou:

It worked perfectly. Thank you so much for your help.


All times are GMT -4. The time now is 05:35 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.