Automatically copy selected fields to a summary library

173 views
Skip to first unread message

Červeňák Viktor

unread,
Jul 23, 2025, 3:10:44 PM7/23/25
to mementodatabase

Hi,

In the Memento Database app, I have three libraries that are similar in structure but serve different purposes. I would like to create a fourth (summary) library, which would contain a selection of data from all three.

In this summary database, I only want to include certain fields that I will specify – not all fields or entire records.

My goal is that whenever I create a record in any of the three original libraries, a record is automatically created in the fourth (summary) one – but only with the selected fields.

Is it possible to set up such an automatic synchronization, linking, or extraction in Memento Database using scripts, triggers, or any available mechanism?

Thanks in advance

Er Mo

unread,
Jul 23, 2025, 3:56:09 PM7/23/25
to mementodatabase
Hallo
Ja .Man kann beim Erstellen eines Neuen Eintrage ein Skript ausfüren lassen das die Daten vom Eintrag holt und in einen Neuen Eintrag in der Zusammenfassung schriebt . Das muss dann in Jeder Bibliothek gemacht werden .

Hello
Yes. When creating a new entry, you can run a script that retrieves the data from the entry and writes it to a new entry in the summary. This must then be done in each library.

Ernst

Červeňák Viktor

unread,
Jul 24, 2025, 1:08:52 AM7/24/25
to mementodatabase
Hi, 
 Could you please show me step-by-step how to set up the script and automation rule that copies selected fields from my library into a summary library when a new record is created?  

Thanks

Dátum: streda 23. júla 2025, čas: 21:56:09 UTC+2, odosielateľ: ernst...@gmail.com

Er Mo

unread,
Jul 24, 2025, 2:53:43 PM7/24/25
to mementodatabase
Hallo
Du muss in der Bibliothek VON der die Daten genommen werden ein " Trigger " Erstellen .Mit den Einstellungen " Erstellen eines Eintrags " " Bevor der Eintrag  gespeichern wird " . In den Kopist du das Skript . Du muss in Zeile 2 den Bibliothegsname " Übersicht " mit deinen Namen ersetzen . Weiters muss du unter " Erlaubnise " der Bibliothek erlauben auf diese Bibliothek zuzugreifen ( Anhacken ) . In Zeile 3 bis 5 werden die Werte von den Felder geholt . Auch hier die Namen ändern . ab Zeile 7 wird in die " Übersicht " Bibliothek geschriben . Auch hier dieFeldnamen Ändern . Wenn du noch mehr Felder Kopieren willst , füge eine weitere Zeile hinzu . Acht auf die Schreibweise der Feldnamen in den 2 Verschiedene Bibliotheken .

Hello
You need to create a "trigger" in the library from which the data is taken. With the settings "Create an entry" "Before the entry is saved." Copy the script into the script. In line 2, you need to replace the library name "Overview" with your name. Furthermore, under "Permissions," you need to allow the library to access this library (check the box). Lines 3 to 5 retrieve the values from the fields. Change the names here as well. Starting in line 7, the data is written to the "Overview" library. Change the field names here as well. If you want to copy more fields, add another line. Pay attention to the spelling of the field names in the two different libraries.

Skript:
var e = entry()
var lib = libByName("Übersicht")
var felda = e.field("Feld A")
var feldb = e.field("Feld B")
var feldc = e.field("Feld C")
// Schreiben
 let obj = {};  
    obj["Feld A"] = felda;
    obj["Feld B"] = feldb;
    obj["Feld C"] = feldc;
    lib.create(obj);

Ernst

Červeňák Viktor

unread,
Jul 25, 2025, 3:04:30 AM7/25/25
to mementodatabase
Thank you very much!

Dátum: štvrtok 24. júla 2025, čas: 20:53:43 UTC+2, odosielateľ: ernst...@gmail.com

Červeňák Viktor

unread,
Jul 31, 2025, 12:54:24 AM7/31/25
to mementodatabase
Hello, I have one more question. I have one date field in both libraries. And when I create a record in the library, all the fields are automatically copied to the overview library, but the date field is not. Is there any way to fix this?

Dátum: štvrtok 24. júla 2025, čas: 20:53:43 UTC+2, odosielateľ: ernst...@gmail.com
Hallo

Mmm

unread,
Jul 31, 2025, 7:29:34 AM7/31/25
to mementodatabase
Если используете скрипт Ernst и дата не копируется, можете присвоить значение полю дата после создания копии записи.

var e = entry()
var lib = libByName("Übersicht")
var felda = e.field("Feld A")
var feldb = e.field("Feld B")
var feldc = e.field("Feld C") //date
// Schreiben
 let obj = {};  
    obj["Feld A"] = felda;
    obj["Feld B"] = feldb;
   
    var ne = lib.create(obj);
    ne.set("Feld C", feldc); //date


четверг, 31 июля 2025 г. в 07:54:24 UTC+3, cervenak...@gmail.com:

Bill Crews

unread,
Jul 31, 2025, 10:25:25 AM7/31/25
to Mmm, mementodatabase
    var ne = lib.create(obj);
    ne.set("Feld C", feldc.getTime());

As I recall, copying a date field using set() requires the use of the getTime() method of the Date object, no? As above.


--
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 visit https://groups.google.com/d/msgid/mementodatabase/d5a1c972-9ca9-4a27-9ade-03473f6c0133n%40googlegroups.com.

Er Mo

unread,
Jul 31, 2025, 12:32:30 PM7/31/25
to mementodatabase
Hallo
Datum und Zeit ist eine Eigene Sachen . Memento Mießt die Zeit ( Millisekunten ) die Vergangen ist von 1.1.1970 00:00 weck . So ist die Zahl hinter den Datum eine Große Zahl . Die Anzeige hingegent ist das Datum ( In ihrer Landesform ) . Wie Bill schon schrieb muss man " .getTime() " verwenden um die richtige Zahl zuerhalten . Um es so wie die Anderen Felder zuverwenden musst du Variable ein mal Umschreiben . Also
var feldc1 = e.field("Feld C")
var felds = feldc1.getTime()
So ist dan " felsc " die Große Datumszahl und müsste in einen Datumfeld das Datum ergeben .

Hello
Date and time are separate things. Memento measures the time (milliseconds) that has passed from January 1, 1970, 00:00. So the number after the date is a large number. The display, however, is the date (in its local format). As Bill already wrote, you have to use ".getTime()" to get the correct number. To use it like the other fields, you have to rewrite the variable once. So
var feldc1 = e.field("Field C")
var felds = feldc1.getTime()
So "felsc" is the large date number and should yield the date in a date field.

Ernst

Mmm

unread,
Jul 31, 2025, 1:54:56 PM7/31/25
to mementodatabase
У меня работают все варианты:
1. Скрипт Ernst.
2. Мой скрипт.
3. Через getTime().
4. Через new Date().

Тестовые библиотеки:
https://mementodb.com/s/euAxTENSF
https://mementodb.com/s/QhKeyUF79

четверг, 31 июля 2025 г. в 19:32:30 UTC+3, ernst...@gmail.com:

Er Mo

unread,
Jul 31, 2025, 2:59:20 PM7/31/25
to mementodatabase
Hallo
Ja . Dafür musst du das selbe Skript in ein " Aktion " , Eintragsansichtskarte Schreiben / Kopieren . Du hast dann im Eintragansicht eine " Play Pfeil " oben Rechts . Wenn du darauf klikst wird das Skript gestartet . Man kann auch Mehrer Einträge gleichzeitig abarbeiten . Dafür braucht mann aber eine Änderung in Skript .

Hello
Yes. To do this, you need to write/copy the same script into an "Action" entry view card. You'll then see a "Play arrow" in the top right corner of the entry view. Clicking on it starts the script. You can also process multiple entries at once. However, this requires a change in the script.

Ernst
Reply all
Reply to author
Forward
0 new messages