What schould I d be here (mobile challenge 6.x)

Helllo, 

IM trying to do the addition challenge where I have to make a wrapper around the createOrUpdate action.

But I cannot figure out what schould be in Id here 



anyone a hint ?

Hi Roelof,

A CreateOrUpdate does one of these 2 database actions, dependent on whether the id is populated with an existing id.  So you'll have to add id as an input to your server action, and when on a screen where you are updating an existing ToDo, you will somehow have this id available, and need to pass it into your server action.  When on a screen where you are adding a new ToDo, pass in the NullIdentifier() into your server action.

Good Luck,

Dorine


P.S. Kudos to you for trying the extra optional assignments, that's the best way to see if you can apply what you've learned.

oke, 


So I need a if then ? 


And what does the condition then be ?  as far as I can see I do not have a record that I can use.


Roelof

Well, 

the wrapper you are developing, will have the id as import, and all you need to do is pass it to the CreateOrUpdate of your entity like you do with all the other imports.  So no if inside the wrapper.

Now when you use the wrapper to create a new ToDo, you will not have an id yet.  You will either have an empty result in an aggregate or you could pass nullidentifier explicily when calling this server action, I don't know the details of the exercise.

When, on the other hand you are updating a ToDo, then you will have an id available to pass to this wrapper. (For example because the user has chosen an existing ToDo in a list and passed it to a detail screen)

Hope this clarifies it for you,

otherwise, feel free to ask.

Dorine

hmm, Still not clear to me. I understand what you  mean but I do not see any aggregte at all to which I can compare against. 

The challegnge says only this :  

As an optional challenge for this Lab, let’s create one Server Action for Creating or Updating
ToDos in the Database.  


I think I oversee something but I do not know what so I will include my oml file. 



Solution

Ok Roelof,

I changed your CreateOrUpdateTodo : renamed the outgoing todoId to OutToDoId, added a new input with the name ToDoId, and used that new id to give in input of the entity action.  Also added assign to give the id to the output.

While I was there, also added a Delete Wrapper.  Set both new wrappers to public, so they will be available from the module that has your screens.

So if you want to test this new wrapper, you could go into the logic of the detail screen and change following: remove what I indicated in yellow, and replace the create wrapper by the createOrUpdate wrapper. (marked with red arrow)

Good luck,

Dorine


Solution