How to simultaneously save master and detail records

How to simultaneously save master and detail records

  
Being a novice, and working on a small initial application, can someone help with this issue. I need the experimental application attached to save both into the Request and RequestDetails table when clicking the Save button. Can someone check the Preparation (queries), the Save Action, etc and assist in recommending a better way to make it run. Currently, when I click Save, it only saves Request records (the records in the master table). Once I get this 'technique' right, then my learning curve will be shorter from here. Thank you in advance!
Regards,
Rodwell

Rodwell,

on your Save action you need to have a CreateorUpdateRequestDetails Action after CreateOrUpdateRequest Action
you have to consider the case that if it's a new Request you need to assign the RequestId to the RequestDetails record

Regards,
João
Joao, thank you very much for the response. I added the other CreateOrUpdateRequestDetails Action, ad I tried to run it like that - it returned same results as before. I think as you said, I need to consider how I assign the RequestId to the RequestDetails record. Now, as I am still learning, can I have further guidance on that, maybe it's an advanced query or something else I am not aware of. Please help! I will also appreciate a 'send-back' of the corrected file if possible - so that I can follow through where I was missing it. Thank you.

Regards,


Rodwell
Hi Rodwell,

I've seen you espace and here goes my opinion.

The Preparation action seems ok, however the Save action misses a For Each widjet, along with an Assign (for record build) and a CreateOrUpdateRequestDetails, in order for you to save each row of the request detail table. Consider placing it after the CreateOrUpdateRequest action, using its output parameter to get the Request Id.

I hope I've helped.

Regards.
Pedro Ávila
Pedro,
I appreciate your direction, it's something I never considered, and I havent learnt something. Just that I think I am missing something again, am not sure if what I added in the Save Action after the CreateorUpdateRequest action is alright or not: I need to be sure what I put is right - like, what are the 2 connectors from the For Each widget, where the Assign widget comes in before the last added action CreateorUpdateRequestDetails. I added some steps as you suggested but am still asking myself questions, where I could be wrong again?. Maybe you can assist with attaching an image of what the Logic looks like?

Thanks in advance for extra assistance.

Rodwell



Hi Rodwell,

I am currently starting to learn Outsystems also. I was thinking about this master/detail record scenario the other day and I will be very interested to see your final result when you acheive this with help from the community.

Could you keep me (us) posted as you work through this. Ideally i would love so see you post the completed code as an attachment here.

I wish I could assist you.

Thank you
Mark


 
Hi Redwell,

Please find attached your oml with the necessary widgets already in place. You need to complete it... but what is in there is enough to get the point. I prefered to make you thing how you accomplish things instead of doing things for you...
I suggest you to take the online Developer Course (http://www.outsystems.com/training/Course.aspx?CourseId=0&TrackId=56) for cut your learning curve.

Regards.
Pedro Ávila




Rodwell Chireshe wrote
:
Pedro,
I appreciate your direction, it's something I never considered, and I havent learnt something. Just that I think I am missing something again, am not sure if what I added in the Save Action after the CreateorUpdateRequest action is alright or not: I need to be sure what I put is right - like, what are the 2 connectors from the For Each widget, where the Assign widget comes in before the last added action CreateorUpdateRequestDetails. I added some steps as you suggested but am still asking myself questions, where I could be wrong again?. Maybe you can assist with attaching an image of what the Logic looks like?

Thanks in advance for extra assistance.

Rodwell


 
 
 
Pedro - After coming back from a short break, I finally got the clues, and managed to get it working, many thanks to your 'taking me by the hand'. When I trace back the whole components you directed me, I learnt faster about widgets, the logic behind and all. In the future, I definitely can build master-detail edit screens from the PRACTICAL direction you provided. The only thing i discovered is, probably because of much testing back and forth (the previous clicks on the Save button), i found many rows of 'empty' records added to the Request Details list table...so I had to add a DELETE button to remove the records. Hopefully that cleans it up. Otherwise, thanks once again.