sir,

please see below mentioned flow:

when control is going to TimeSheetDetailTable.List my source list contains two record than going to assignment values are assign to list. and going to CreateOrUpdateSheetDetails again going for each loop for taking my second record and further process is going on but complete foreach() loop process only show one record in my database table. but in my above mentioned process flow foreach() loop process is going with 2 record.


Please help what steps i missed or why my 2nd record is overwrite in my database table.


Thanks in advance.

Hi Amit,


good to see you solved your For Each problem !  Can you maybe share in the other post what turned out to be the problem, future learners might profit from that.


could you share here the runtime values in debug after each Assign right before each CreateOrUpdate, and a screenshot of the database values afterwards.  This is probably related to identifier problem, do you have an autoincrement identifier on your timesheetdetails ??


Dorine


Dorine Boudry wrote:

Hi Amit,


good to see you solved your For Each problem !  Can you maybe share in the other post what turned out to be the problem, future learners might profit from that.


could you share here the runtime values in debug after each Assign right before each CreateOrUpdate, and a screenshot of the database values afterwards.  This is probably related to identifier problem, do you have an autoincrement identifier on your timesheetdetails ??


Dorine




Ok, so where is that id 33 coming from, and what is it's value for the other timesheetsdetail you are trying to create.  

After each createorupdate, you can inspect the id of the database record in the output, can you take a look at that ?

can you also show the Assign statements ?

Dorine Boudry wrote:

Ok, so where is that id 33 coming from, and what is it's value for the other timesheetsdetail you are trying to create.  

After each createorupdate, you can inspect the id of the database record in the output, can you take a look at that ?

can you also show the Assign statements ?


Solution

Hi Amit,

I saw all the screenshot mentioned by you in above post. I can see in a loop you are using CreateOrUpdateTimesheetdetails action to save or update data.

Secondly, from other screenshot we can see TimesheetDetailsId is 33 for one record and in other you have two id i.e. 61 & 0 but this is for Timesheet entity not Timesheetdetails.

Please can you check your TimesheetDetailsTable.List contains same id for the 2 record or not?  If it is only updating 1 record every time in the database this means it contains same value for id in both the records you want to save.


Hope this will help you.


Thanks,

Rajat Agrawal

Solution

Thanks all, sorry for late reply.

I am having both the records with same id. and this is the issue because of which it is always overwriting the single record with same id everytime.