Broken associations by reference selector with Selectable Objects
We have an Airport entity with more than 3000 airport records, about 250 are Frequently Used Airports. They are marked as selectable ( with Boolean ). On a page in the flights entity, a reference selector has an xPath [Selectable] for only showing the selectable airports. But once in a while a user wants to choose a not “ Frequently Used Airport”. So an extra button behind the reference selector gives the opportunity to choose for non “ Frequently Used Airport”. After the user choose one, the link is set ( was visible via debugger ), but after closing the select pop-up dialog, the reference selector on the main page becomes empty and the just added association is broken again. So, I looked a little bit deeper, what will happen when I make airport JFK, not selectable anymore. Will that break the associations of exist records as well. In the list, we see still some JFK records ( logically ). However, after opening the edit page with the reference selector on it, the link with JFK will be broken directly. ! Extra info…. The reference selector had an On Change Event, but even after deleting that event it still goes wrong ! Especially, the second option is dangerous because associating will be broken, only by opening a page. I replaced the Mx Reference selector by the AutoCompleteForMendix Widget from the appstore, and everything works fine. We are using 6.10.4 I have with the AutoCompleteForMendix a temporary fix, but maybe someone has a hint, a fix or solutions.
Jan de Lange
First, you need to distinguish between two things: what is in your database, and what the user is shown in the user interface. Using the alternative selection method, data is written to you database (if you commit it there, or if it has been previously committed, like your example) which will not be shown in the user interface. This may not be a problem if the object from that screen is not committed. The path through your application Default screen ==> Special selectable screen ==> Save ==> Default screen ==> Save will probably lead to problems.
Note, however, that this works exactly like you programmed: you made certain only selectable airports can be set, but that is not your requirement. Your requirement seems to be: selectable or whatever has been selected. This changes your constraint to:
Flight_Airport = '[%CurrentObject%]']
To my knowledge, this behavior isn't new: I ran into this 'problem' in Mendix 3.