Populate Tree Field

116 views
Skip to first unread message

Doris Reilly

unread,
Jun 5, 2025, 11:17:43 AM6/5/25
to mementodatabase
I have tried to populate a tree field from a CSV with inconsistent and incorrect results.  I eliminated all commas and single quotes from the data, and the tree doesn't build correctly.  If I import the values into a text field, the import works fine.  I am using Memento Desktop for Windows.

I have made the library with the text field available as a public at the link: https://mementodb.com/s/hDebJ6Z9j

This library has three fields:
  RecipeTree -- tree field with the results the import from the CSV file,
  RecipeTreeEmpty - tree field with no data currently,
  RecipePathText -- text field with import from the same CSV into a text field.

I populated the data in two different imports -- first into the RecipePathText field, and then imported into the RecipeTree field.

I also uploaded to Google Drive the CSV file I used to import: https://drive.google.com/file/d/1JtmcZ_ZzTAkshVnw2V09fJQGLCwykHW5/view?usp=drive_link

Is there a way to write a script to populate the RecipeTreeEmpty field with the contents of the RecipePathText field?

Otherwise, I will just need to enter the tree data manually...that might be the most efficient way at this point, after spending a day trying to get the import to work.

Thanks in advance,

Doris





Mmm

unread,
Jun 5, 2025, 12:33:54 PM6/5/25
to mementodatabase
Загрузите файл CSV, который не смогли импортировать (для ознакомления).
В первоначальном виде, с непоследовательными и неверными данными. 

Ваш текстовый файл (disitinct_path_from_all_recipes.txt) переименовал в disitinct_path_from_all_recipes.csv
Первую строку в нем ("MODIFIED_PATH") заменил на "RecipeTreeEmpty".
Для поля "RecipeTreeEmpty" в библиотеке указал Роль - Название (имя записи) и Разрешить множественный выбор - снято.
Осуществил импорт из  disitinct_path_from_all_recipes.csv без изменения настроек импорта.
Проверял на Memento Desktop for Windows 3.4.4.

четверг, 5 июня 2025 г. в 18:17:43 UTC+3, doris....@gmail.com:
Scr_1.jpg
disitinct_path_from_all_recipes.csv

Mmm

unread,
Jun 5, 2025, 1:18:02 PM6/5/25
to mementodatabase
Второй успешный способ для  Memento Desktop for Windows - копирование записей с помощью правил копирования.

1. Создайте копию своей библиотеки и добавьте в нее текстовое поле "temp".
2. Откройте исходную библиотеку, выделите все записи и создайте правило копирования (см. скрин).
3. Выполните копирование. Поле - дерево будет заполнено.

Третий успешный способ с помощью мобильной версии для Андроид - инструмент преобразование поля.
На Memento Desktop преобразование поля не нашел.

1. Открыть библиотеку для редактирования. 
2. Преобразовать поле "RecipePathText" в тип "дерево" (старое поле сохранить).
3. Поле - дерево будет заполнено. Останется переименовать новое  и старые поля.

четверг, 5 июня 2025 г. в 19:33:54 UTC+3, Mmm:
Scr_2.jpg

Mmm

unread,
Jun 5, 2025, 2:26:36 PM6/5/25
to mementodatabase
Скрипты действие в библиотеке или меню массовых действий:

let entries = lib().entries(); //действие в библиотеке
//let entries = selectedEntries(); // меню массовых действий

for (let e of entries) {
    let abc = e.field('RecipePathText');
    e.set('RecipeTreeEmpty', abc);
}

message(' Done! ');

Раскомментируйте нужную строку (1 или 2).

четверг, 5 июня 2025 г. в 20:18:02 UTC+3, Mmm:

Doris Reilly

unread,
Jun 5, 2025, 6:03:04 PM6/5/25
to mementodatabase
Wow, not one but four solutions!

Solution 1 did not work consistently, so I abandoned that.

Solutions 2 and 3 worked great.

Did not try Solution 4 because 2 and 3 worked.

I found that trying to have commas in the names did not work consistently with Solution 2, so I am going to eliminate commas and single quotes in order to not cause myself further grief.

I appreciate the help!

Doris

Reply all
Reply to author
Forward
0 new messages