Embeded Object Issue

143 views
Skip to first unread message

karam mohammed 1

unread,
Jul 14, 2025, 1:17:37 PM7/14/25
to mementodatabase


Hello everyone,

I have a field called Transactions which is an embedded object. Each transaction has two attributes:

date

paid


I want to filter the data by date, but I'm having an issue:

Example:

I have these two transactions:

Date: 12 July, Paid: 300

Date: 14 July, Paid: 500


When I filter by Today’s date, both transactions are showing up — even the ones that aren’t from today.
But I want to display only the transactions where the date is exactly today.

Can someone help me filter this correctly? using scripting if needed.
Thanks in advance 



Er Mo

unread,
Jul 14, 2025, 3:44:03 PM7/14/25
to mementodatabase
Hallo
Ich glaube der Filder funktioniert nur auf Feld Ebene . Welcher Eintrag sollte Angezeigt werden wenn das Datum Stimmt ? Andergesagt Der Eintrag wird Angezeigt wenn EIN Datem Übereinstimmt . Wenn mehrer sind muss nur eines Stimmen . Du müsste für jedes Datum einen eignen Eintrag erstellen .

Hello
I think the filter only works at the field level. Which entry should be displayed if the date is correct? In other words, the entry is displayed if ONE date matches. If there are multiple dates, only one has to match. You would have to create a separate entry for each date.

Ernst

Mmm

unread,
Jul 14, 2025, 4:23:28 PM7/14/25
to mementodatabase
Предположу, что фильтр нужен для решения другой задачи - подсчета суммы платежей сегодня.
Тогда можно воспользоваться агрегацией или виджетом агрегации по скрытому полю JS:

let today = moment();

let transactions = field("transactions");

try {

    let paid = 0;

    let items = transactions.filter(a => today.isSame(moment(a.Date), 'd'));

    items.map(a => paid += Number(a.Paid));

    paid;

catch (err) {
    0;
}

Поле JS сделать "скрытым" после создания виджета (при создании виджета агрегация не видит скрытые поля).

понедельник, 14 июля 2025 г. в 22:44:03 UTC+3, ernst...@gmail.com:

karam mohammed 1

unread,
Jul 16, 2025, 5:33:00 AM7/16/25
to mementodatabase
I don't need to calculate aggregation . I just need to show only filtered data. And also without creating another liberary If this possible

Mmm

unread,
Jul 16, 2025, 7:30:45 AM7/16/25
to mementodatabase
Вариант "иллюзии" фильтра объектов в поле встроенный объект.
Результат скрипта сохраняется в дополнительном поле "transactions+".
Видимость поля  "transactions" или  "transactions+" зависит от значения логического поля "today".

Тестовая библиотека:
среда, 16 июля 2025 г. в 12:33:00 UTC+3, kara...@gmail.com:

karam mohammed 1

unread,
Jul 16, 2025, 7:31:58 PM7/16/25
to mementodatabase
 thank you mmm.  You're always so smart, and helpful. Truly appreciate your help and Also I am following how you help others.

You're amazing. thank you very much for this smart solution. It worked more than I expected 

karam mohammed 1

unread,
Jul 17, 2025, 6:39:09 AM7/17/25
to mementodatabase
Sorry . I also need to modify script so instead of filter by today , to filter by value of date argument named (day) 
I tried alot to modify it but it faied
Thanks in advance

Mmm

unread,
Jul 17, 2025, 7:38:48 AM7/17/25
to mementodatabase
Вариант с выбором даты. Если в скрипте не указана дата - выполняется "фильтр сегодня". 
Шаблон с примером:

четверг, 17 июля 2025 г. в 13:39:09 UTC+3, kara...@gmail.com:

karam mohammed 1

unread,
Jul 17, 2025, 8:43:11 AM7/17/25
to mementodatabase
Thank you very much  again .. Perfect
Reply all
Reply to author
Forward
0 new messages