![]() |
#16 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,370
Karma: 6957792
Join Date: Nov 2010
Location: Ottawa, ON
Device: Kobo H2O
|
Quote:
|
|
![]() |
![]() |
![]() |
#17 |
Series Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,180
Karma: 167189477
Join Date: Dec 2010
Location: Florida, USA
Device: Kindle Paperwhite (2nd Gen)
|
Chaley - Going off of a similar issue as the previous "penny problem" (thanks again
![]() Unfortunately, calibre can not seem to determine the difference between "0.00" and "undefined", nor can I point out that distinction in the rules, so anything that has not yet been priced, has also been "highlighted". Any suggestions? Please & Thank you. Last edited by Nyssa; 10-25-2014 at 10:27 AM. |
![]() |
![]() |
![]() |
#18 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You can get around this by using an advanced rule that can check if the column is empty before comparing it to zero. Here is an example: Code:
program: test(field('#myfloat'), cmp(raw_field('#myfloat'), 0, '', '#00aa00', ''), '') You must use raw_field() in the comparison because of the formatting. The word "Price" is not a number. You must use field() in the test so you can tell the difference between empty and "Price: 0.00" (or whatever it is). |
|
![]() |
![]() |
![]() |
#19 | |
Series Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,180
Karma: 167189477
Join Date: Dec 2010
Location: Florida, USA
Device: Kindle Paperwhite (2nd Gen)
|
Quote:
![]() Code:
test(field('#price'), cmp(raw_field('#price:0.00'), 0, '', '#2aa29e', ''), '') Last edited by Nyssa; 10-25-2014 at 11:55 AM. |
|
![]() |
![]() |
![]() |
#20 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
1) The "program:" in my example is important. That tells the template processor that what follows is code and not text. 2) the raw_field() should contain '#price' without the ':0.00'. This should work Code:
program: test(field('#price'), cmp(raw_field('#price'), 0, '', '#2aa29e', ''), '') |
|
![]() |
![]() |
![]() |
#21 | |
Series Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,180
Karma: 167189477
Join Date: Dec 2010
Location: Florida, USA
Device: Kindle Paperwhite (2nd Gen)
|
Quote:
Unfortunately, even after adding program, (and removing the zeros) the code did not work. ![]() |
|
![]() |
![]() |
![]() |
#22 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#23 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
This is what you should see in the advanced rule editor, except for #price instead of #myfloat.
|
![]() |
![]() |
![]() |
#24 | ||
Series Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,180
Karma: 167189477
Join Date: Dec 2010
Location: Florida, USA
Device: Kindle Paperwhite (2nd Gen)
|
Quote:
Quote:
Its still not seeing a difference between "0.00" and "undefined". |
||
![]() |
![]() |
![]() |
#25 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#26 |
Series Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,180
Karma: 167189477
Join Date: Dec 2010
Location: Florida, USA
Device: Kindle Paperwhite (2nd Gen)
|
|
![]() |
![]() |
![]() |
#27 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I am running out of ideas because it works fine for me.
The following 4 attachments show what I have done. First, I created a column #price so we aren't using different columns. Next I entered a rule: Here is that rule in the list: And here is the result: As you can see, the line with price 0.00 is green and the lines with no price are not. Idea: some other rule is being applied to the lines so that the "price" rule is being ignored. Try moving the price rule to the top. |
![]() |
![]() |
![]() |
#28 | |
Series Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,180
Karma: 167189477
Join Date: Dec 2010
Location: Florida, USA
Device: Kindle Paperwhite (2nd Gen)
|
Quote:
I forgot to remove the original price related rule. I was so busy making sure I had the code written correctly I forgot about the other one. So I had both the standard "If the price column is equal to value: 0.00", rule and the code you gave me. When you had asked me if i had removed the code that didn't work, I meant the one that I had copied incorrectly. Scrolling the code to the top made me realize that the other one was there, even though I was looking at it the whole time. Last edited by Nyssa; 10-25-2014 at 05:11 PM. |
|
![]() |
![]() |
![]() |
#29 |
Series Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,180
Karma: 167189477
Join Date: Dec 2010
Location: Florida, USA
Device: Kindle Paperwhite (2nd Gen)
|
It all works!
![]() ![]() Thank you Chaley!!! ![]() |
![]() |
![]() |
![]() |
#30 |
Zealot
![]() Posts: 145
Karma: 12
Join Date: Jun 2017
Location: Australia
Device: Mac Pro 2013 & Mini 2018, iPad Mini 4, iPhone 11, iBooks, K4Mac/PC
|
@chaley, thanks for this information. It looks very useful and I think I will use the colouring for free books.
I'm also assuming you could get Calibre to also do the following with composite columns? If price is value or 0.00, have another column say either BOUGHT or FREE using logic... On the other hand, I do have two currencies (Australian dollar & Japanese Yen). Would it be possible to choose which currency to choose from in one column, or would you need to make another column? If you had to have another column #price2, could you set that to be active if the #price1 is blank?
Inukami |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Price Custom Column Formatting Help | PaulineDesigns | Library Management | 13 | 07-22-2022 09:23 PM |
Custom column returns value based on value of another custom column? | calvin-c | Calibre | 3 | 09-14-2013 02:24 PM |
Custom yes/no column built from long text column | Philantrop | Library Management | 7 | 03-23-2013 07:44 PM |
how to move value(s) of tag column to a custom made column | zoorakhan | Library Management | 0 | 12-08-2012 03:53 AM |
Can custom book data be displayed in a custom column? | kiwidude | Development | 9 | 03-02-2011 05:35 AM |