Multiple filters based on xpath with multiple entities over a list in a microflow

0
I am currently working on a project in which employees of an organization can reserve desks. I want to perform a validation in a Microflow: Is the workplace available on the specified date for the specified time slot (enumeration)? If so, present these desks back to the user in reference selector. The desks, the reservations and the timeslots are all in their own entities. Does anyone have an example of an xPath I can apply to create such a filter on a list? I have been smashing my head about it for several hours and I am not getting any further.
asked
7 answers
1

HI Nick,

 

That is the easy part ;-).

Just define your end event of your microflow with the following settings:

1: this is your end event of your microflow

2: select in the type “list” and select your desk entity

3: put your list as variable at point 3.

Hope this helps...

 

answered
1

We need a bit more info here. Assumption is that the desks have a status like free and reserved. So in the microflow you could retrieve them on basis of the status free. Other assumption is that you also have an object with all the days of the year. If not that still would be a good thing to add. Just create a microflow that creates all the days of the current year. Then attach the timeslot to these days. So each day has x number of timeslots. If those are enum that is ok.
Now the user part. If you have the days you can present the user with a calendar where it can pick the day. Then based on that you can retrieve the day object. Then check for each slot enum if there is already a reservation for that slot. Otherwise show the user the available slots. Think if you create all these slots in advance or that you only store reserved slots.

Hope this helps or otherwise give more info about your domain model.

Regards,

Ronald

 

answered
1

I think you need a “helper” entity with an association to desk, timeslot and a date field (see SearchHelper)

This is a simplified version of your datamodel for explanation purposes.

So I created a page to fill the helper function including an boolean to show availability:

The page is filled based on a microflow that creates a new SearchHelper:

 

When pressing the “Check Availability” the Available field is filled in the microflow (CheckAvailability):

As the Search helper is non-persistent you have to retrieve the desk and timeslot before doing the retrieve on ReservationReguest. The retrieve is like this:

 

This is a basis you could use although not complete. I’m missing additional checks when morning or afternoon is reserved while request is for both. You can also include a grid that shows the available desks on a given date and timeslot.

 

Hopes this will help.

answered
0

 

I would like to give you some additional information! Workplaces can be reserved by choosing a part of the day (3 options in an enumeration: morning, afternoon or morning & afternoon).
I have not made a specific list of dates to be reserved because we can use the date field for that (we do not filter out Saturdays and Sundays). I have assumed that it would be relatively easy to present a list of workplaces that do NOT have a link between a date and the chosen time block.

But if I understand correctly, would an adjustment in the domain model make things simpler and thereby give the possibility to give the calendar a function to the user?

For your information, the link between desk and team ensures that teams can only reserve specific workplaces through an Xpath. The time attributes at the timeslot entity make it possible to reuse the information in, for example, notifications.

Regards,

Nick

answered
0

Does somebody have a clue how to fix this microflow and xpath? :)

answered
0

Hi André, Thank you for the extra rising questionmark. Simpler is better :-).

So you suggest to add the timeslot to the reservationrequest entity and then filter on that attribute?

I recreated your microflow, and i was questioning myself do i need to add a decision between the retrieve list from database and set the boolean to true? Otherwise it always shows it like available.

 

 

answered
0

Thank you all for your input, i cracked it and fixed it in the app. Stil have some issues to fix but those aren't directly related to the way this microflow works.

answered