04-24-2023, 04:40 AM | #601 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Don't know for sure. I think that the existing function will be replaced with a body that returns an error. I am doing other things so I am not going to test this.
|
04-24-2023, 04:44 AM | #602 |
Custom User Title
Posts: 8,851
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
This probably won't be a problem unless you plan to name one of the functions has_data(). And I'll probably see it in the changelogs first
|
Advert | |
|
04-24-2023, 04:51 AM | #603 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The equivalent function will be named has_extra_data(). I am also planning to add functions extra_data_files(sep) that returns a sep-separated list of files, extra_data_file_modtime(file_name), and extra_data_file_size(file_name).
|
04-30-2023, 03:21 PM | #604 |
Guru
Posts: 734
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
|
I found something similar in this post ( https://www.mobileread.com/forums/sh...&postcount=537 ) to what I'm looking to do in my library but can't get it to work for me.
Let me explain I have personal identifiers in the ids field and a personalized column of which store I bought the book. What I'm looking for is that if the store custom column says Amazon, it only brings me the Amazon ids in another column. It seems to me that it is the essence of that form but it brings me all the identifiers Last edited by dunhill; 04-30-2023 at 03:27 PM. |
04-30-2023, 03:36 PM | #605 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
Advert | |
|
04-30-2023, 04:57 PM | #606 | |
Guru
Posts: 734
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
|
Quote:
program: def do_one(ids, check_value, select_identifier): if = select(ids, select_identifier); if !$#libreria==check_value && if then return list_difference(ids, strcat(select_identifier, if), ',') fi; return ids fed; ids = do_one($identifiers, "Amazon",'amazon'); ids = do_one(ids, "Cuspide", 'cuspide'); ids = do_one(ids, "Yenny", 'yenny'); ids = do_one(ids, "Baen", 'baen') I have a column #libreria is the store where I buy the book Usually Yenny and in the identifiers cargo yenny:9789504968566 what I wanted is if in the store field it is Yenny just see the isbn of yenny Last edited by dunhill; 04-30-2023 at 05:10 PM. |
|
04-30-2023, 05:23 PM | #607 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: def do_one(ids, check_value, select_identifier): sel = select(ids, select_identifier); if !$#libreria==check_value && sel then return list_difference(ids, strcat(select_identifier, sel), ',') fi; return ids fed; ids = do_one($identifiers, "Amazon",'amazon'); ids = do_one(ids, "Cuspide", 'cuspide'); ids = do_one(ids, "Yenny", 'yenny'); ids = do_one(ids, "Baen", 'baen') Sorry, but the complexity here is higher than I can cope with. |
|
05-04-2023, 08:22 AM | #608 |
Custom User Title
Posts: 8,851
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
What is the best way to check a column for multiple patterns and return for any matches? Here is what I have:
Code:
program: omnibus = if 'Box Set' in $title || 'Complete Series' in $title || '(Books|Volumes) (\d+-\d+)' in $title then 'omnibus' else '' fi; list_union(omnibus, $#admintags, ',') Last edited by ownedbycats; 05-04-2023 at 08:25 AM. |
05-04-2023, 08:29 AM | #609 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: omnibus = if '(Box Set)|(Complete Series)|((Books|Volumes) (\d+-\d+))' in $title then 'omnibus' fi; |
|
05-04-2023, 08:35 AM | #610 |
Custom User Title
Posts: 8,851
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Yes, I was thinking of doing something like that. Would make adding new patterns a bit tricky. I think that may not be an issue as the ones I have cover 80% of my existing omnibuses - I'm not going for every possible variation, just the most common ones.
Last edited by ownedbycats; 05-04-2023 at 08:39 AM. Reason: clarification |
05-04-2023, 08:38 AM | #611 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Using regex alternation (or) is much faster than doing sequential checks. And there is nothing to prevent you from adding another check if fitting into alternation is too hard.
|
05-06-2023, 04:09 PM | #612 |
Custom User Title
Posts: 8,851
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Mostly out of curiosity about how something works again.
program: $#timesread + 1 This returns '1' program: add($#timesread, 1) This returns '1.0' Why are they different? (also just realized I should be using $$, oops...) Last edited by ownedbycats; 05-06-2023 at 04:11 PM. |
05-06-2023, 04:27 PM | #613 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The add operator (+) checks the result and converts the float to an int if the fractional part is zero. One can argue that defining it this way was wrong, but so be it. Before you ask: no, I am not going to change the behavior of either one. Note that the results are arithmetically identical. If you don't like the ".0" then use round(), floor(), ceil(), fractional_part(), or format_number() to convert it. Or use re() to strip off the .0, as in Code:
re(add(3), '^(.*)\.0$', '\1') |
|
05-06-2023, 05:11 PM | #614 |
Custom User Title
Posts: 8,851
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
In this case, the output is being written to an int column so it'd turn out the same anyways.
|
05-07-2023, 11:16 AM | #615 | |
Guru
Posts: 734
Karma: 228142
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
|
Quote:
As I said before, I wanted to modify the ownbycats template But I tell you what I have. I have a custom identifier yenny and cuspide: And a library column (which is where I bought the book from) Yenny, Cúspide, Amazon I would like to have the identifier number in another column depending on the Library column. If in the library column it says Yenny In another column it would have to show me only the identifier of yenny If in the library column it says Cúspide In another column it would have to show me only the identifier of cuspide If in the library column it says Amazon In another column it would have to show me only the amazon identifier I thought that essentially what the ownbycats template did could help me, if you can guide me in this regard, I would be very grateful Last edited by dunhill; 05-07-2023 at 11:19 AM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 153 | 05-14-2024 01:30 AM |
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates | Boilerplate4U | Development | 13 | 07-07-2020 02:35 AM |
Questions on Kobo [Interfered with another thread topic] | spdavies | Kobo Reader | 8 | 10-12-2014 11:37 AM |
[OLD Thread] Some questions before buying the fire. | darthreader13 | Kindle Fire | 7 | 05-10-2013 09:19 PM |
Thread management questions | meme | Feedback | 6 | 01-31-2011 05:07 PM |