Bulk Action Help

176 views
Skip to first unread message

Harry Contos

unread,
Mar 29, 2025, 4:36:37 PM3/29/25
to mementodatabase
Hello, i am not a programmer so i usually end up using bits and pieces from this group and other sources to try and make my stuff work.
I am having trouble getting the Bulk Action function to work on more than one record at a time in my Memento DB.
 may have lines i don't need but I don't know. 
Any help in showing or explaining how to get more than one record to update will be appreciated. 
I mostly use Android phone and tablet but occasionally use my windows PC.
I select all records and use the button to do the bulk update. 

Below is the script i am trying to use for my project.

var a = selectedEntries();
for (var i = 0; i < a.length; i++) {
var enrty = a[i];
var text = "http://bcca-usbc-supplement.com/Volume"
var text2 = "SupplementDetailView.aspx?@CanIdentifierForDetailView="
var FSPic = "http://bcca-usbc-supplement.com/images/SupplementImages/"
var FSPic2 = ".jpg"
var bk = entry().field('USBC_Book')
var bpf = entry().field('Back')
var pfs = entry().field('Pic fs')
var pg = entry().field('USBC_Page')
var numb = entry().field('USBC_Number')
var add = entry().field('USBC_Add')
var cani = entry().field('CanIdentifier')
var book = (bk);
var picF = (bpf);
var zb = (pg);
var ci = (cani);
var zc = (numb);
var ad = (add);
var jp = (".jpg");
var tx = (text);
var tx2 = (text2)
var test = ("");
var FS = (FSPic2);
var res = test.concat(tx,bk,tx2,ci);
var resfs = test.concat(FSPic,ci,FSPic2);
entry('pic fs, ').set('pic FS',resfs);
var b = entry.field('pic FS');
entry.set("USBC Front", b)
}


thank you,
Harry

Er Mo

unread,
Mar 29, 2025, 5:23:35 PM3/29/25
to mementodatabase
Hallo
Was willst du mit den Skript erreichen . Was soll es Tuhen

Hello
What do you want to achieve with the script? What should it do?

Ernst

Harry Contos

unread,
Mar 29, 2025, 5:38:44 PM3/29/25
to mementodatabase
The DB is for my collection of beer cans.  It is set up to go out and get hyperlinks to another website so i can see the pictures i need for my collection. I have put together multiple fields from my DB to create the web link address needed for the picture to show.
I have a few thousand records that i need to update and doing one at a time seems senseless. 
Let me know if this helps.

Harry Contos

unread,
Mar 29, 2025, 5:43:33 PM3/29/25
to mementodatabase
I need it to go through all the selected records and update using that code i shared. As i stated i am not a programmer so that code may be more than needed but works for a trigar on an update and its working on the first record selected using the Bulk Action function.

Er Mo

unread,
Mar 29, 2025, 6:07:42 PM3/29/25
to mementodatabase
Hallo
Wenn ich das Skript richtig lese durch läufst du die Einträge in einer Schleife ( Zeile 2 ) . In Zeile 3 gibst du den AKTUELLER Eintrag in den Variablen " entry " . In den Zeilen 8 -14 Verwendes du aber NICHT den Variable " entry " sonder den Befehl " entry() " , das ja der gerate Ausgerufene Eintrag ist . Also ändere in Zeile 8 - 14 das " entry() " auf "entry " und versuche es noch mal .
Aus Sicherheitsgründen würd ich NIE Test an der ORIGINALEN Bibliothek durchfüren , sonder eine Kopie mit Einträgen erstellen und da Testen . Wenn alles klappt dann in der Originalen Bibliothek durchfüren .

Hello
If I'm reading the script correctly, you're looping through the entries (line 2). In line 3, you enter the CURRENT entry in the variable "entry." In lines 8-14, however, you're NOT using the variable "entry," but rather the command "entry()," which is the entry called. So, in lines 8-14, change "entry()" to "entry" and try again.

For security reasons, I would NEVER test the ORIGINAL library; instead, I would create a copy with entries and test it there. If everything works, then test it in the original library.

Ernst

Harry Contos

unread,
Mar 29, 2025, 7:55:21 PM3/29/25
to mementodatabase
Hello Ernst, thank you for the help. Unfortunately that did not work and it no longer even updates the first record. I get this erroe but not sure what it means. 

Script Error: TypeError: Cannot find function field in object function
entry(){...

20250329_134353.jpg

Er Mo

unread,
Mar 30, 2025, 3:12:16 AM3/30/25
to mementodatabase
Skript:

var a = selectedEntries();
for (var i = 0; i < a.length; i++) {
var cani = a[i] .field("CanIdentifier")
//var ci = (cani);

var test = ("");
var resfs = test.concat(FSPic,cani,FSPic2);
a[i].set("pic FS",resfs);
a[i].set("USBC Front",resfs)
}
message(resfs)

Er Mo

unread,
Mar 30, 2025, 3:12:54 AM3/30/25
to mementodatabase
Hallo
Habe das Skript mal getestet und festgestellt das es auf das Feld "pic FS " und " USBC Front " den Text " http://bcca-usbc-supplement.com/images/SupplementImages/ " plus den Wertd vom Feld " 'CanIdentifier' " plus ".jpg" schreibt . Wenn das das ist wast du willst müsste es gehen .

Hello
I tested the script and found that it writes the text "http://bcca-usbc-supplement.com/images/SupplementImages/" plus the value from the "'CanIdentifier'" field plus ".jpg" to the "pic FS" and "USBC Front" fields. If that's what you want, it should work.

Ernst

Er Mo

unread,
Mar 30, 2025, 3:15:00 AM3/30/25
to mementodatabase
ps
Letzte zeile Löschen ( message(resfs) ) Zeigt nur den Text der Geschriben wird.

ps
Delete last line ( message(resfs) ) Shows only the text being written.

Ernst

Mmm

unread,
Mar 30, 2025, 4:17:53 AM3/30/25
to mementodatabase
Упрощенный вариант библиотеки.
Добавлена ссылка на страницу Five Panel View. 

1. Общий скрипт:

function canIdentifierData(ec) {

    let e = ec ? ec : entry();
    let ide = e.field('CanIdentifier');

    if (ide) {
        let book = e.field('USBC_Book') ? e.field('USBC_Book') : ide.slice(0, 1);

        let url = "http:/\/bcca-usbc-supplement.com/Volume" + book + "SupplementDetailView.aspx?@CanIdentifierForDetailView=" + ide;

        let pic = "http:/\/bcca-usbc-supplement.com/images/SupplementImages/" + ide + ".jpg";


        e.set('USBC_Page', url);
        e.set('USBC Front', pic);
        e.set('pic FS', pic);
        e.set('five pic FS', pic_5);
    }
}

2. Скрипт меню массовых действий:

for (let item of selectedEntries()) {
    canIdentifierData(item);
}

message(' Done! ');

3. Скрипт Действие в карточке записи и триггер создание записи перед сохранением:

canIdentifierData();

Для тестов:


воскресенье, 30 марта 2025 г. в 10:15:00 UTC+3, ernst...@gmail.com:
IC_30032025.jpg

David Gilmore

unread,
Mar 30, 2025, 10:28:55 AM3/30/25
to mementodatabase
Going back to the original post, and the original code, wanted to point out the obvious mistakes.

First the user's selection is fetched into an array, then the intent is to cycle through that array processing each selected entry. Line 3 pulls out one at a time each of those array elements, and places it into a simple variable called "enrty" (note the spelling here). Line 8 through 14 is then trying to use that simple variable to get entry field values, but by mistake is using a function call "entry()" instead of that simple variable. (The function "entry()" returns an array of the all of the entries in the library.)

First of all, do not use a name for your simple variable that is just a misspelling of a function call. Gets confusing. I would suggest using the name "e" instead. Then in lines 8-14 use that simple variable.

Line 3:
var e = a[i];

Line 8-14:
var bk = e.field('USBC_Book');
var bpf = e.field('Back');
var pfs = e.field('Pic fs');
var pg = e.field('USBC_Page');
var numb = e.field('USBC_Number');
var add = e.field('USBC_Add');
var cani = e.field('CanIdentifier');

Last three lines:
e.set('pic FS',resfs);
var b = e.field('pic FS');
e.set("USBC Front", b)


(I recognize that "enrty" was probably a simple typing error, but that typing error did create a simple variable.)

David Gilmore

unread,
Mar 30, 2025, 11:26:57 AM3/30/25
to mementodatabase
Oops and correction, the function "entry()" returns the pointer to the current entry, "entries()" returns the array of pointers to all of the entries in the library. I am not sure that there is a "current" entry in this use case,.

Harry Contos

unread,
Mar 30, 2025, 1:42:55 PM3/30/25
to David Gilmore, mementodatabase
David, thank you so much! Your information and changes made my action work the way I intended. 
I appreciate it.

Thanks,
Harry

Sent from my Verizon, Samsung Galaxy tablet
Get Outlook for Android

From: memento...@googlegroups.com <memento...@googlegroups.com> on behalf of David Gilmore <aa6...@gmail.com>
Sent: Sunday, March 30, 2025 5:26:57 AM
To: mementodatabase <memento...@googlegroups.com>
Subject: Re: Bulk Action Help
 
--
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/818e4ceb-c0bf-444f-951f-4d0013932efbn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages