Changing field type not possible

126 views
Skip to first unread message

Gencin Biri

unread,
Sep 13, 2024, 7:19:07 PM9/13/24
to mementodatabase
I have a abc field ( just for manually input ) in which we have written the date like 2024-09-14 format. I want to change this field to date, so i can select the date. much easier then manually writing. But changing field type is not possible. What suggestions do you have ?

RG T

unread,
Sep 14, 2024, 3:05:03 AM9/14/24
to Gencin Biri, memento...@googlegroups.com
Bonsoir,
Effectivement impossible de modifier le  champs pour le modifier en date.
2 solutions si la base est peu importante cŕéer un champs date et recopier les dates.
Autre solution avec un bouton, ecrire un script avec un argument champs date qui remplira le champs texte initial.
Peut-être que d'autres auront des idées plus pertinentes.
TRG

Le sam. 14 sept. 2024, 01:19, Gencin Biri <freak...@gmail.com> a écrit :
I have a abc field ( just for manually input ) in which we have written the date like 2024-09-14 format. I want to change this field to date, so i can select the date. much easier then manually writing. But changing field type is not possible. What suggestions do you have ?

--
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/0ebb4a53-6b80-47d6-86a7-eed55ed21735n%40googlegroups.com.

RG T

unread,
Sep 14, 2024, 3:05:03 AM9/14/24
to Gencin Biri, memento...@googlegroups.com
Essayez ce script, le bouton ne prend pas d'argument donc script action, lieu : vue enregistrement, cocher moment ( tout en bas). "votre champs" mettre à la place le nom du champs recevant la date. 
Je pense également que le script peut être mis en script déclencheur.
TRG

var e = entry();
//DECLARATIONS VARIABLE
var vc = entry().field("votre champs");

//DECLARATIONS ARGUMENTS
var date = arg("Date")
var date2 = moment(date).format("YYYY/MM/DD")

//ECRITURES
e.set("votre champs", date2)

Er Mo

unread,
Sep 14, 2024, 3:23:25 AM9/14/24
to mementodatabase
Hallo
Wenn es nicht viele Datensätze sind würde ich ein Datumsfeld " Datum2 " einbauen und in jeden Eintrag das Datum vom Text in das Datumsfeld schreiben . Wenn alles umgestellt sind das Alte Datum löschen und Datum2 in Datum umbennenen .

Hello
If there aren't many records, I would add a date field "Date2" and write the date from the text in the date field for each entry. Once everything has been changed, delete the old date and rename Date2 to Date.

Ernst

Mmm

unread,
Sep 14, 2024, 7:38:27 AM9/14/24
to mementodatabase
Согласен.
Добавьте новое поле (тип дата).
Скопируйте все "правильные" даты из тестового поля в поле дата скриптом Действие в библиотеке.

Проверка дат с использованием moment().isValid(). 
Источник:

Требуется подключение moment.min.js.

let entries = lib().entries();

for (let e of entries) {
    if (moment(e.field('abc')).isValid()) {
        let date = new Date(e.field('abc'));
        e.set('date2', date);
    }


суббота, 14 сентября 2024 г. в 10:23:25 UTC+3, ernst...@gmail.com:
Reply all
Reply to author
Forward
0 new messages