I have a parent and child business objects, LabourReviewProductCell (Parent) and LabourReviewAllocation (Child). In the Child BO users add records of people and then allocate X amount of hours for the next three weeks. This is set up by having three different columns to represent the current and next two weeks: Week0, Week1, and Week2. At the start of each week I need the system to automatically “shift” the hours to its proceeding column so that the data is always kept up to date.
I thought that this would be reasonably simple, as I could just use a process to say BO.Week0 = BO.Week1, BO.Week1= BO.Week2 and so on and run this every Monday morning. But for some reason this is acting differently to how I would expect; When I call the process, it will take the last value of the record entered and update all of the other records with this value.
Has anyone done anything similar to this and got it working?
Process
Find ALL LabourReviewAllocation
LabourReviewAllocation.AllocatedHoursWeek0 = LabourReviewAllocation.AllocatedHoursWeek1
LabourReviewAllocation.AllocatedHoursWeek1= LabourReviewAllocation.AllocatedHoursWeek2
LabourReviewAllocation.AllocatedHoursWeek2 = 0
Shift Data from one column to another within a Child BO
Shift Data from one column to another within a Child BO
- Attachments
-
- Capture.PNG (6.12 KiB) Viewed 1505 times
-
- Posts: 1463
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Shift Data from one column to another within a Child BO
What you process does is bring ALL of your records into Context and then change all of the values to the value of one arbitrary record. AIM can't build edit multiple records to multiple different values.
If you want to make each individual record be modified then you need to pass these to a second process individually.
Process 1
Process 2: UpdateRecprds
Input LabourReviewAllocation
This second process will receive exactly one record process the updates then cycle through the next record until all of the records from the FIND are completed, before moving on to any subsequent processes.
The process you used originally is good for instance when you want to change all of the records to one value, for example changing all of the Accounts in a system to have a new SalesAssociate.
If you want to make each individual record be modified then you need to pass these to a second process individually.
Process 1
Code: Select all
Process
Find ALL LabourReviewAllocation
UpdateRecords
Input LabourReviewAllocation
Code: Select all
LabourReviewAllocation.AllocatedHoursWeek0 = LabourReviewAllocation.AllocatedHoursWeek1
LabourReviewAllocation.AllocatedHoursWeek1= LabourReviewAllocation.AllocatedHoursWeek2
LabourReviewAllocation.AllocatedHoursWeek2 = 0
The process you used originally is good for instance when you want to change all of the records to one value, for example changing all of the Accounts in a system to have a new SalesAssociate.
-
- Posts: 2418
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: Shift Data from one column to another within a Child BO
Alternatively (But not recommended as it is slower)
Find ALL LabourReviewAllocation IN BATCHES OF 1
Find ALL LabourReviewAllocation IN BATCHES OF 1
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Re: Shift Data from one column to another within a Child BO
Thank you, its working perfectly now!
I did try something similar to this before, but I put 'IF SEARCH_COUNT > 0' at the beginning of the second process which made it not work.
I did try something similar to this before, but I put 'IF SEARCH_COUNT > 0' at the beginning of the second process which made it not work.
-
- Posts: 1463
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Shift Data from one column to another within a Child BO
If you want to improve efficiency and not run the process when there are no records returned from the search then
Process
Code: Select all
Find ALL LabourReviewAllocation
IF SEARCH_COUNT >0 THEN UpdateRecords