Problème widget

41 views
Skip to first unread message

RG T

unread,
Jan 15, 2026, 2:34:15 PM (3 days ago) Jan 15
to mementodatabase
Bonjour à tous,
Petit problème de widget.
Sur une base de données relative au données d'une station météorologique je veux afficher sur deux widgets la journée la plus chaude et la journée la plus froide.
Pour cela deux scripts calculent les températures hautes et basses.pour chaque journée.
Les widgets sont du type liste enregistrement avec la date et la valeur. Une seule ligne n'est affichée. Il n'y a aucun filtre seul un tri ascendant pour la valeur la plus basse et descendant pour la valeur la plus haute.. Le widget pour la température la plus basse fonctionne parfaitement. La date et la valeur sont corrects. Par contre le widget pour la température la plus haute seul la date est affichée, elle est correcte mais la valeur n'apparait pas. Si qielqu'un a déjà eu ce problème je suis preneur de la solution.
Merci de votre aide.
TRG

Hello everyone,
I have a small widget problem.
I want to display the hottest and coldest days on two widgets in a database containing data from a weather station.

Two scripts calculate the high and low temperatures for each day.

The widgets are list-type records with the date and value. Only one row is displayed. There are no filters, only an ascending sort for the lowest value and a descending sort for the highest value. The widget for the lowest temperature works perfectly. The date and value are correct. However, the widget for the highest temperature only displays the date, which is correct, but the value doesn't appear. If anyone has encountered this problem before, I would appreciate a solution.

Thank you for your help.
TRG


Mmm

unread,
Jan 16, 2026, 6:46:51 AM (3 days ago) Jan 16
to mementodatabase
Возможно поможет дополнительный фильтр, который отсекает записи без температуры или даты.

let entries = lib().entries();
let filter = entries.filter(a => a.field('tt') !== undefined && a.field('date'));//дополнительный фильтр температуры и дат

if (filter[0]) {
    let items = filter.sort((a, b) => b.field('tt') - a.field('tt'));//для минимальной температуры изменить сортировку на обратную 
    let e = items[0];

    let dd = moment(e.field('date')).format("DD.MM.YYYY");
    let max = e.field('tt');

    let uiT1 = ui().text(max).font({
        size: 16, color: "#3F51B5", style: "bold"
    }).width(250);//цвет и ширину установить свои

    let uiT2 = ui().text(dd).font({
        size: 12
    });

    ui().layout([uiT1, uiT2]).horizontal();
} else {
    ui().text('Aucune donnée');
}

четверг, 15 января 2026 г. в 22:34:15 UTC+3, trg...@gmail.com:
Scr_1.png

RG T

unread,
Jan 16, 2026, 9:16:24 AM (3 days ago) Jan 16
to Mmm, mementodatabase
Bonjour à tous,
Merci pour ton aide Mmm.
J'ai résolu le problème, mais ne me demandai pas pourquoi il est résolu, seulement comment. Si cela peut aidé quelqu'un ayant un problème similaire.
J'avais au départ un seul script pour chercher la valeur la plus basse ou la plus haute. J'ai dupliqué ce script, donc j'avais le script initial et le n°2. Je pensais que afficher la valeur et faire le tri sur le même script pouvait provoquer cette erreur. Le script n°2 est placé dans "champ de la première ligne", "champ de la dernière ligne" contient la date et le "tri" ce fait sur le script initial. Si l'on change de place les deux scripts cela ne fonctionne pas?? Cependant la valeur s'affichait en blanc même si je changeais la couleur, j'ai rajouté dans mon script n°2 du texte (unité) et la couleur est maintenant celle choisit??
Pour Mmm j'avais déjà placé un filtre.
TRG

Здравствуйте, все!
Спасибо за помощь, Mmm.

Я решил проблему, но не спрашивал, почему, а только как. Возможно, это поможет кому-нибудь с похожей проблемой.

Изначально у меня был один скрипт для поиска наименьшего или наибольшего значения. Я продублировал этот скрипт, так что у меня остались исходный скрипт и скрипт №2. Я подумал, что отображение значения и его сортировка в одном и том же скрипте могут вызывать эту ошибку. Скрипт №2 помещен в «поле первой строки», «поле последней строки» содержит дату, а сортировка выполняется в исходном скрипте. Если переместить два скрипта, это не работает. Однако значение отображалось белым цветом, даже если я менял цвет. Я добавил текст (единицу измерения) в скрипт №2, и теперь цвет тот, который я выбрал.
Для Mmm я уже добавил фильтр.
TRG

Hello everyone,
Thank you for your help, Mmm.

I solved the problem, but I didn't ask why it was solved, only how. Perhaps this will help someone with a similar problem.

Initially, I had a single script to find the lowest or highest value. I duplicated this script, so I had the original script and script #2. I thought that displaying the value and sorting it in the same script might be causing this error. Script #2 is placed in the "first row field," the "last row field" contains the date, and the sorting is done in the original script. If the two scripts are moved, it doesn't work. However, the value was displayed in white even if I changed the color. I added some text (unit) to script #2, and the color is now the one I selected.
For Mmm, I had already added a filter.
TRG

--
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/5399d1a0-ac09-4323-ab99-ddb061f8646bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages