See if value of object with association already exists

0
Hi,  Still working on my app and trying to keep data consistent. I now have the following challenge which I can't seem to solve with the forum and learning paths.   I have an object “Beschikbaarheid” with an association to “Docent”. A docent has to fill in his availability (Beschikbaarheid). “Werkdag” is an attribute of Beschikbaarheid, which is an enumeration with the 5 days of the week (maandag, dinsdag, woensdag, donderdag, vrijdag).   Obviously I only want a teacher to fill in his availaibility for a day once, so he shouldn't be able to fill in the form for “Maandag” twice. Before comitting the availability, I want the microflow to check if there is already an object Beschikbaarheid with the value of Werkdag for the teacher who filled in the form.    I think I have to retrieve the object $Beschikbaarheid/Beschikbaarheid_Docent first. But which expression should I use for the decision? I tried something with isNew or starting with “$Beschikbaarheid/Dag”​, but this all doesn't make any sense :)  Thanks in advance.   Kind regards, Ralph
asked
3 answers
1

Hi Ralph,

 

if you commit a new Beschikbaarheid for the Docent, you can in the microflow retrieve the Docent and from that point all the other Beschikbaarheid objects associated to that Docent. You can then user “Filter” option to see if the attribute Dag of any object in that lists, matches the value of the newly created Beschikbaarheid object.

 

For example:

answered
1

Nevermind! Double checked my decision = empty. But accidentally used != empty. It works! Thank you so much.

answered
0

I probably have to insert a merge between the two decisions and delete one end point. However, I tried the flow without the decision “Starttijd voor eindtijd”, but this didn't work either.

answered