I am working on re-creating a page from an app we previously created in ASP.NET MVC to see if we can rapidly create small scale apps using Mendix. We have an external SQL DB, and everything is done through stored procedures and the DB tables, this includes all associations. Our current app uses four global combo box filters on every page to narrow down the data set in SQL: Plant, Area, Line, Station. The user selects a plant which contains many areas, then the user selects the area which contains many production lines, then the user selects the production line which contains many stations, then the user selects the station. These values are passed into a GET stored procedure and used to narrow down the retrieved data set for whatever data grid the user is viewing, so plant, area, line, station are typically not values displayed in the resulting data grid, they are only filters. All data in the Mendix app would come from the SQL DB. It appears the only way to populate any sort of drop down menu is if there is an association or the data is an enumeration or boolean. I asked a question in the forum previously, and was told I could edit an association in a microflow and then use that to populate reference selectors. I have not been successful in doing this, but I also don’t like the idea of having to loop through data to create an association when the association already exists in the SQL DB. I have also tried creating a plant self-reference to populate a reference selector with the plant names, and have been unsuccessful in that. It seems like there would be a simple way to populate a combo box type menu on a screen without looping through data to create associations, and the direction of parent/child isn’t a limiting factor. Any help would be appreciated. I have included a screen shot of my plant and area entities in the domain model. PKplant is the key that associates the plant and areas in the SQL DB.
Create four non-persistent entities for respectively Plant, Area, Line and Station. No association is needed. Feed the Plant to the page as datasource.
OnChange of Plant trigger a nanoflow to get the Area's from the external SQL. Feed it to the Area selector.
OnChange of Area trigger a nanoflow to get the Line’s from the external SQL. Feed it to the Line selector.
OnChange of Line trigger a nanoflow to get the Station’s from the external SQL. Feed it to the Station's selector.
OnChange of Station trigger a nanoflow to get the datagrid content from the external SQL. Feed it to the datagrid.
This is the most lightweight approach and done on the Mendix clientside.