--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/2eb3826f-b220-4a4d-aca1-4fefcc07ca7dn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/75a85c9c-2816-4cc2-ba02-aaf5a9affed4n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/a430b949-c37a-4efd-a0ab-45c9646fab30n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/9915d526-2ac9-43ad-9d90-c66ffc5df7aan%40googlegroups.com.
Well, excellent, Javier. So, we're past the error message, at least. When I said to replace the final message() line with the e.set() line, I also suggested you retain the shortened message(), but since you didn't do that one thing, you're getting no indication of a result when it finishes. And since the action script doesn't add an entry to CONTROL, you get no result there, either. We'll fix it.
It may sound bad right now, but we're getting there. I think the next try may get you what you want. I'll try to be clear enough to help you make that the case.
So, what I was trying to shift you to do was to use an entry in CONTROL to represent a query, with a timestamp, optionally 2 query input fields, & one query output field. Your current action script doesn't create that entry.
So, to create it, though we could manually create an entry from within the action script, it is much cleaner & more natural to just add the entry, provide any input, like date & time, maybe an author and/or a genre, and the script can match against the inputs and create the entry.
To run upon creating an entry in CONTROL, it is most natural to place your script into a trigger that fires After Creating The Entry. For the following procedure, I'll assume you might care about the author and maybe also the genre. The result cab be in a field called EBOOKEPUB if you like, but I'd probably call it #Books or something like that.
First, the procedure to run the query…
Open CONTROL
The current date & time will be filled in automatically. If you want a count only of books by an author, fill in the Author field. (If authors are kept in their own library, that would be a selection from the list of author links. If they're in a choice list field in CONTROL, then it would be a selection from that list. The same for the genre.) If you don't care about the author or genre (field Genre), don't enter anything into those fields, but do create those fields if you want my script to work.
When you push the checkmark icon to save & close the entry, the trigger script will run, so some time will pass, and then the entry will be saved with the #Books field filled in, and if you entered an author and/or a genre, that'll be there, as well.
So, you'll be collecting the timestamped queries along with any query parameters & the number of matching books based on those parameters.
To get from where you are to that status, I think you'll need to do the following…
Copy my trigger script below. It is an edit from your action script.
Still within Scripts, add a trigger this time, indicating that it should trigger After Creating The Entry.
Then, you'll be in the script editor, so start by pasting my copied script into the editor.
Name the script whatever you like & save it.
If you want to disable your action script, you could do that now. It's just a matter of whether the Play button shows up when you open CONTROL.
Here's the trigger script…
let e = entry();
let author = e.field("Author");
let genre = e.field("Genre");
let ah = libByName("Libros 0-H");
let im = libByName("Libros I-M");
let nz = libByName("Libros N-Z");
let ahentries = ah.entries();
let imentries = im.entries();
let nzentries = nz.entries();
let nbooks = 0;
for (x in ahentries) {
let ebook = ahentries[x];
if (ebook.field("EPUB") == True) {
if (((author == null) || (author == ebook.field("Author")) &&
((genre == null) || (genre == ebook.field("Genre")))
nbooks += 1;
}
}
for (x in imentries) {
let ebook = imentries[x];
if (ebook.field("EPUB") == True) {
if (((author == null) || (author == ebook.field("Author")) &&
((genre == null) || (genre == ebook.field("Genre")))
nbooks += 1;
}
}
for (x in nzentries) {
let ebook = nzentries[x];
if (ebook.field("EPUB") == True) {
if (((author == null) || (author == ebook.field("Author")) &&
((genre == null) || (genre == ebook.field("Genre")))
nbooks += 1;
}
}
e.set("#Books", nbooks);
Now, about the script changes…
Triggers operate on the current entry, so we by convention set e to that entry (in CONTROL). The next 2 lines fetch any parameter values you might have entered into variables for use in the for loops.
In the for loops, I changed the entry variable name to ebook to distinguish it from the entry in CONTROL. I also added additional conditions for nbooks to be incremented. If you don't enter anything into a parameter field, the variable (author or genre) will be null and will therefore not affect the match.
I used my name for the book count in the CONTROL entry. Sorry. I typed it before thinking.
So, we're using the same general mechanism as we were before, just making it into a trigger to get the CONTROL entry.
Regarding Ernst's message, we each contribute ideas and don't feel we are competing. His ideas are good. In this case, I argue for mine for the flowing reasons…
I don't see that you want to keep query information about each book library, but only overall. Of course, I could be wrong.
Putting scripts in the book libraries would complicate the process. Maybe Ernst envisions a benefit that I'm not realizing.
I'm sure that my colleague Ernst will agree that we hope you'll use whatever ideas either of us contributes. We are each guessing what you really want, so of course, either of us could guess incorrectly.
Please continue to let us know how it goes, and good luck.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/6db66ea7-59f4-480b-912a-7f381477263bn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/c18b4453-5c01-4318-a917-ceb25c826683n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/e7a0a4f5-c2bc-41fa-b1fc-4760515424adn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/74ea033d-8b5e-454a-9b36-62455a3fa40cn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/7da84d97-37a4-4af0-acf6-ba071d709091n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/b6f89756-b61a-463f-af1c-6f99cf1aafdfn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/6e8d4183-a48e-40cf-bc4d-f615b08f4fdan%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/73cce11d-5ab5-4e1e-9867-d781b08fcfffn%40googlegroups.com.
Hallo Javier
Hab 2 Bibliotheken zum Testen erstellt .
CONTROL : enthält 1 Eintrag mit 2 Feldern . Datum = das Datum der letzten Änderung und das Feld EPUB mit einen Zahl . Diese Werten werden vom Skript Überschrieben . Es wird IMMER in den Letzten Eintrag geschrieben . Wenn du einen Wert behalten willst , kannst du einen Neuen Eintrag erstellen und der Vorige wird nicht mehr geändert . Du muss aber das Feld „ EPUB „ auf den Aktuellen Stand bringen.
LIBROS : 1 Feld Name ist ein Text. 2 Feld EPUB ein Kontrollkästchen und 3 Feld Die Schaltfläche. Diese Bibliothek brauch die Erlaubnis auf die CONTROL zuzugreifen .Wenn du auf die Schaltfläche klickst wird der Wert im Kontrollkästchen geändert und in der Bibliothek „ CONTROL“ ( der Letzte Eintrag )das Datum auf Heute gestellt und die Zahl um 1 Erhöht oder Verringert . Das Skript dafür ist in der Schaltfläche gespeichert und kann einfach auf andere Felder geändert werden . So könntest du in der CONTROL weitere Zählfelder einbauen .
Zum ansehen der Bibliotheken muss du sie Kopieren und die Kopie
öffnen
Hello Javier
Created 2 libraries for testing.
CONTROL: contains 1 entry with 2 fields. Date = the date of the last change and the EPUB field with a number. These values are overwritten by the script. It is ALWAYS written to the last entry. If you want to keep a value, you can create a new entry and the previous one will no longer be changed. But you have to update the “EPUB” field.
LIBROS : 1 Field Name is a text. 2 field EPUB a checkbox and 3 field the button. This library needs permission to access the CONTROL. When you click on the button, the value in the checkbox is changed and in the library "CONTROL" (the last entry), the date is set to Today and the number is increased or decreased by 1. The script for this is stored in the button and can easily be changed to other fields. So you could install additional counting fields in the CONTROL.
To view the libraries you must copy them and open the copy
Ernst
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/749020ef-4e07-42bb-b1bc-c3bf91466533n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/99c101b2-8491-4199-915a-2f1b2b271113n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/f12c39fa-cec7-4270-b9a0-556345396055n%40googlegroups.com.
Hi, Vasya. This is a very long forum message thread that documents Javier's efforts to get centralized control of libraries he has broken into pieces to try (unsuccessfully) get Memento to handle the large dataset. I direct you to the final 2 messages -- one from him and a final one from me.If he's doing what I asked him to do, he put my code (or code of mine converted somehow by him) into an AfterSavingTheEntry trigger that results in 2,000 iterations of a loop (according to a message() call, I believe), but nevertheless does not create the entry! How would that be possible in an AfterSavingTheEntry trigger on CreatingTheEntry trigger? He says he lands back in the entries list, so Memento hasn't crashed. I didn't think that would be possible.Anyway, something to mull over, as I see it.No reply expected. FYI.
Hello, Bill and Ernst:
I understand, Bill, the intention of your proposal to modify the EPUB field format and the script to process only the EPUB field, as there will be fewer entries than the total. However, I prefer not to pursue this approach. The LIBROS libraries have approximately 100,000 entries, with around 33,000 entries in each library. Out of the total entries, approximately 94,000 have the EPUB field activated, which is 95%. Therefore, I believe that narrowing the process down to only the EPUB fields would have little effect, not to mention that it would require a massive modification that I am not comfortable with, as it might end up causing more problems than it solves. Each LIBROS library has 31 fields of various types.
I will wait for Memento to optimize the Android app in the future, as Vasily mentioned to me.
Thank you both for your interest.
Best regards,
Javier
----------------------------------------Hallo Bill und Ernst,
Ich verstehe, Bill, die Absicht deines Vorschlags zur Änderung des Formats des EPUB-Felds und des Skripts, um nur das EPUB-Feld zu verarbeiten, da es weniger Einträge als insgesamt geben wird. Dennoch ziehe ich es vor, diesen Ansatz nicht zu verfolgen. Die LIBROS-Bibliotheken haben insgesamt etwa 100.000 Einträge, mit ungefähr 33.000 Einträgen in jeder Bibliothek. Von den Gesamteinträgen haben etwa 94.000 das EPUB-Feld aktiviert, was 95% entspricht. Daher glaube ich, dass es wenig Effekt hätte, den Prozess nur auf die EPUB-Felder zu beschränken, abgesehen davon, dass eine umfangreiche Änderung erforderlich wäre, bei der ich mich nicht wohl fühle, da sie möglicherweise mehr Probleme verursacht, als sie löst. Jede LIBROS-Bibliothek verfügt über 31 Felder unterschiedlicher Art.
Ich werde auf die Optimierung der Android-App durch Memento in der Zukunft warten, wie es mir Vasily angekündigt hat.
Vielen Dank euch beiden für euer Interesse.
Mit freundlichen Grüßen,Javier------------------------------------------Hola, Bill y Ernst:Entiendo, Bill, la intención de tu propuesta modificando el formato del campo EPUB además del script para que solo procese el campo EPUB dado que serán menos entradas que las totales. Sin embargo, prefiero no atenderla. Las librerías de LIBROS suman cerca de 100.000 entradas, a razón de unas 33.000 entradas en cada librería. Del total de entradas las que tienen el campo EPUB activado son unas 94.000, es decir, un 95%. Por ello, entiendo que no tendría casi efecto reducir el proceso solo a los campos EPUB, sin contar que tendría que hacer una modificación masiva que, la verdad, no me atrevo, ya que puede que para arreglar una cosa estropee diez: cada biblioteca de LIBROS tiene 31 campos de todo tipo.Esperaré a que Memento optimice la app en Android en el futuro, tal y como me anticipó Vasily.Muchas gracias a ambos a vuestro interés.Saludos cordiales,Javier
Hello, Bill and Ernst:
I understand, Bill, the intention of your proposal to modify the EPUB field format and the script to process only the EPUB field, as there will be fewer entries than the total. However, I prefer not to pursue this approach. The LIBROS libraries have approximately 100,000 entries, with around 33,000 entries in each library. Out of the total entries, approximately 94,000 have the EPUB field activated, which is 95%. Therefore, I believe that narrowing the process down to only the EPUB fields would have little effect, not to mention that it would require a massive modification that I am not comfortable with, as it might end up causing more problems than it solves. Each LIBROS library has 31 fields of various types.
I will wait for Memento to optimize the Android app in the future, as Vasily mentioned to me.
Thank you both for your interest.
Best regards,
Javier
----------------------------------------
Hallo Bill und Ernst,
Ich verstehe, Bill, die Absicht deines Vorschlags zur Änderung des Formats des EPUB-Felds und des Skripts, um nur das EPUB-Feld zu verarbeiten, da es weniger Einträge als insgesamt geben wird. Dennoch ziehe ich es vor, diesen Ansatz nicht zu verfolgen. Die LIBROS-Bibliotheken haben insgesamt etwa 100.000 Einträge, mit ungefähr 33.000 Einträgen in jeder Bibliothek. Von den Gesamteinträgen haben etwa 94.000 das EPUB-Feld aktiviert, was 95% entspricht. Daher glaube ich, dass es wenig Effekt hätte, den Prozess nur auf die EPUB-Felder zu beschränken, abgesehen davon, dass eine umfangreiche Änderung erforderlich wäre, bei der ich mich nicht wohl fühle, da sie möglicherweise mehr Probleme verursacht, als sie löst. Jede LIBROS-Bibliothek verfügt über 31 Felder unterschiedlicher Art.
Ich werde auf die Optimierung der Android-App durch Memento in der Zukunft warten, wie es mir Vasily angekündigt hat.
Vielen Dank euch beiden für euer Interesse.
Mit freundlichen Grüßen,Javier
------------------------------------------Hola, Bill y Ernst:Entiendo, Bill, la intención de tu propuesta modificando el formato del campo EPUB además del script para que solo procese el campo EPUB dado que serán menos entradas que las totales. Sin embargo, prefiero no atenderla. Las librerías de LIBROS suman cerca de 100.000 entradas, a razón de unas 33.000 entradas en cada librería. Del total de entradas las que tienen el campo EPUB activado son unas 94.000, es decir, un 95%. Por ello, entiendo que no tendría casi efecto reducir el proceso solo a los campos EPUB, sin contar que tendría que hacer una modificación masiva que, la verdad, no me atrevo, ya que puede que para arreglar una cosa estropee diez: cada biblioteca de LIBROS tiene 31 campos de todo tipo.Esperaré a que Memento optimice la app en Android en el futuro, tal y como me anticipó Vasily.Muchas gracias a ambos a vuestro interés.Saludos cordiales,Javier
El lunes, 18 de septiembre de 2023 a las 20:23:43 UTC+2, ernst...@gmail.com escribió:
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/470b7952-30d9-4f8d-bccf-45ee88aeff22n%40googlegroups.com.