Getting a list from Microflow, small help.

0
So on my Datagrid im selecting a micro but getting the Error that my micro is not returning a list. this is what i did, can anyone tell me what i should do, recently new to mendix. on my page i have a schedule, that shows where what is happening. Its a dataview that is set to my tbSchedule "entity" Then below inside i have a datagrid which will list the Attendees. on dgAttendees i set the datasource to MicroGetAttendeesByScheduleID. here is a link to the micro pic, its all the same pic, just diff links : http://tinypic.com/r/11vsfnc/8 http://i58.tinypic.com/11vsfnc.jpg its basically my tbSchedule is my parameter that gets passed thru. i retrieve list from database "Attendees" where XPATH constrain is : [ScheduleID = $tbSchedule/pkScheduleID] i then have a loop to loop thru my attendees and inside my loop is another retrieve from database "Users" where XPATH constraint : [UserID = $IteratorAttendanceAttendee/UserID]
asked
1 answers
3

Hi Raven,

To use a microflow as a datagrid source, the microflow needs to return a list of objects of the same type as the datagrid. Your microflow doesn't currently return anything. Simply set the return type of your microflow to a list of the objects of the type that is in your datagrid (I think Attendees) and put a return value with a list of objects in it ($AttendanceAttendeeList in your microflow). You specify return type and return value in the end event of the microflow (the red circle).

One note: if the AttendanceAttendeeList entity is not a list of users or individuals and is instead a pointer to one or more user, you can display those users via the nested datagrid. It seems like your domain model is as follows:

  • tbSchedule which contains scheduled events
  • AttendanceAttendee which is a list of event attenders
  • tbUser which are users, one or more Users can be associated with an AttendanceAttendee object

If this is the case, to display tbUser objects for an object of type tbSchedule, you'll need to have your nested dataview be of type tbUser and then retrieve all of the users for each tbSchedule object via the microflow. In order to get all users, you'll need to create a list variable in your microflow of type tbUser and, in each loop iteration in your microflow, add tbUserList to your list variable. Then your return value from the microflow will be your list variable.

Hope that helps,

Mike

answered