Yes,It is the expected behavior in Mendix with non-persistable entities when associations are involved.
NPE are lives in session memory, Not stored in database
Deleting/clearing a list shown in a DataGrid2 does not automatically guarantee that all references/associations to those objects are removed everywhere in memory.
In your scenario Month(NPE), RangeSelectDate (NPE) , InDataGrid2 DS microflow generates new RangeSelectDate objects but Old objects were previously associated to the same Month.
Even if you clear the grid,refresh the list,delete displayed objects,
the old associated objects can still remain reachable through:
existing associations,client state,session cache,references held by widgets/microflows.
Instead of Month --association--> RangeSelectDate list,
change that Month parameter -> DS microflow generates fresh list -> Return directly to DataGrid2 and Download microflow regenerates same list again.
It will works.
It won't store generated NPEs on Month,never rely on association retrieval later
and generate on demand every time.
I Hope it helps.
Hi man,
Yes, this is expected the Month → RangeSelectDate association accumulates old NPEs because clearing the displayed list isn't the same as clearing the association.
Simple fix: Stop using the association as your download source. Put the generation logic in a shared sub-microflow:
SUB_GenerateRangeSelectDates(Month) : List of RangeSelectDateThen:
Month, exports the fresh list (don't retrieve via association).This way both always regenerate for the current month, so no stale objects ever pile up.
If you must keep the association: before generating new objects in the DS microflow, retrieve the existing RangeSelectDate list by association from Month and delete it — then generate and re-associate.
Easiest of all: create a new Month object on each month change instead of reusing one. Old associations die with the old Month, and the problem disappears.
I hope this helps
Hello,
Yes, this is expected with non-persistable entities. Even if you delete the list shown in DataGrid2, old NP objects can still remain associated in memory during the session.
What usually works better is:
RangeSelectDate objectsMonthFor download/export, I would avoid relying on previously generated NP objects from the grid. Better to regenerate the data again in the download microflow based on the selected month. That avoids stale objects and memory accumulation issues.