Empty Records Handling

1
Regarding the empty records that sometimes created in the Data base , I handle it in the form data-grid and reference selector by using x-path to prevent displaying it, then using scheduler clearing it later. what I want to discuss here the x-path condition which will prevent showing the empty records , I was using any of the mandatory field to check it is not empty to be shown. And while I was analyzing the data I noticed that most of empty records has created date = changed date while the non empty records there is difference between created date and changed date, So I am asking if i can use this condition to filter or to delete the empty records . and it does make sense because there is difference time between making new object (where created date = changed date) and committing the object (where changed date is going to change). But Unfortunately when I imported some data from excel file through Excel Importer Module , I found some records that created date = changed date, so I don't know the mechanism of setting created and changed date, and if i can depend on this condition or not.
asked
3 answers
0

No you cannot depend on the condition createdDate != changedDate, this could easily be the same. Why not add a boolean attribute yourself that you change on your save button? Call it IsInitialized or something like that. Remember to set it to true in all ways that this object is created.

Though if you rollback objects properly on cancel, this problem only occurs if people close their browsers (or navigate away) often while in the process of creating an object. I'm not sure it's worth it.

answered
0
  • you are right about this condition is not perfect,which would be nice if it was true rather than adding this Boolean and managing it myself which is difficult to apply on all the entities so I will not be able to use the default save button of mendix and need micro-flow button to do this change or using event like after commit and both are costing.

  • Regarding it is worth or not,we have Business intelligence software that making statistics on many levels of entities like count of records which may gives wrong result about them .

answered
0

Tested a bit this morning (in 3.0, but my guess is that the same holds for 2.5).

The empty records are indeed tricky. A rollback action does not always delete uncommitted objects. It only deletes them if they were not changed outside the form that creates them. If your application somehow changes the object in another transaction (without commit), the rollback will not remove the records. And if you close the form and then rollback in some later stadium, the rollback won't work remove neither, and you will end up with empty records.

So currently managing your own Bools seems the most reliable approach in complex cases.

answered