Maker of the Month Challenge: June 2020

3
Hello, Makers!   We’re excited to announce the Maker of the Month challenge of June. What is the challenge you might wonder? We'll challenge you with a new challenge based on the new release every month, the perfect opportunity to test and to show off your Mendix skills. Whoever provides the right answer with the best explanation, receives a free fancy Mendix t-shirt and a ‘Maker of the Month’ badge on your developer's profile.  Mendix 8.10 Release Video   Challenge: How many dog(s) will be there in $DogList in NF_SynchronizeDog in the use-case below? You’re building an offline-first native application with the following nanoflow: This Nanoflow calls the following microflow: Assumption: The database is empty before executing this nanoflow.   Please include your explanations for the correct answer, and make sure your Mendix account is public so we know who you are as our next potential winner! The winner will be announced in the next release video.    Good luck everyone!
asked
8 answers
5

In  $DogList there will be only 1 Dog. Effectively $NewDog_1 and $NewDog_2 are both Commited at their creation but the new Sync to Device action perform a kind of check before synchronizing the list or the object to the device as below. 

If the object to synchronize to a device is deleted in the same microflow, sync to device activity will remove it from the offline database, if found.https://docs.mendix.com/refguide/sync-to-device )
 

So, $NewDog_1 is removed before syncing to the offline database. 

At the end, the microflow will sync 1 dog to the offline database and we will found this dog alone in the $DogList in the Nanoflow: NF_SynchronizeDog. 

answered
3

1 dog; if the object to synchronize to a device is deleted in the same microflow, the sync will delete it. In this case 1 dog is deleted and the sync will remove it.

answered
3

The $DogList in NF_SynchronizeDog is 1.

'If the object to synchronize to a device is deleted in the same microflow, sync to device activity will remove it from the offline database, if found' (https://docs.mendix.com/refguide/sync-to-device#5-limitations)

Both $NewDog_1 and $NewDog_2 are committed and then it is syncronized.So $NewDog_1 will be removed from the offline database.

Now the $DogList will contain only 1 object (i.e) $NewDog_2.

answered
2

The $DogList is not affected by the delete action, since the list is synchronized and the deleted object is not removed from the list I expect 2 objects to be synched to the offline database.

answered
2

The $DogList will be a size of 2; $NewDog_1 and $NewDog_2 Image 

The deletion of $NewDog_1 has no effect on the $DogList in the microflow Image

In the NF_SynchronizeDog there is 1 Dog in the $Doglist Image

answered
2

1.Initially DogList is created with no list values(Size:0)

2.Creating one NewDog_1 Object  and committing it to database

3.Creating another NewDog_2 Object and committing it to database

4.Add the NewDog_1 to DogList(Size:1)

5.Add the another NewDog_2 to DogList(Size:2)

6.Sync ‘DogList’ to device

  • The Sync to device activity can be used to selectively sync one or more objects or lists to a device and store them in the offline database. It is meant to be used in offline apps and does nothing when used in online ones.
  • So DogList(Size:2) is synchronized to device and stored in offline database

7.Delete the NewDog_1 object from Dog entity

  • NewDog_1 object is deleted from Dog entity
  • NewDog_1 object  also  removed from offline database because synchronization and deleting the object is happening in the same microflow Refer(https://docs.mendix.com/refguide/sync-to-device)
  • So Finally Dog enitity will have only second object NewDog_2(Size:1)

 

Limitation:

If the object to synchronize to a device is deleted in the same microflow, sync to device activity will remove it from the offline database, if found.

answered
1

There will be only 1 dog in the list.

See https://docs.mendix.com/refguide/sync-to-device#5-limitations 

‘If the object to synchronize to a device is deleted in the same microflow, sync to device activity will remove it from the offline database, if found.’

 

Plus: i made a testapp with a count list activity, and the result was 1 dog.

 

answered
1

0 dogs. 

Reason: Autocommited and new objects get skipped.

answered