Split Records
Hi Guys,
I have attached a sample database called CONDOS. It has a subtable called JOB with a parent SERVICE.
The Condos have multiple owners. Each owner has a percentage given in the OWNER table.
I would like to split the Job records into the corresponding owner/ownership % of each Condo/Item for the SPLIT JOB table.
Please help by providing a code that will take each record line in the JOB and split it into each ownership % found in the SPLIT JOB table.
example: If a Condo has 3 owners and 2 Items were fixed in the Condo.... there should be 6 lines in the SPLIT JOB table.
Each of those 6 lines will have the fields found in the JOB table plus the owner and ownership %.
4 replies
-
try this in a button:
let t := this; for loop1 in JOB do for loop2 in loop1.CONDO.OWNER do let newRec := (create SPLIT_JOB); newRec.( SERVICE := t; CONDO := loop1.CONDO; OWNER := loop2; ITEM := loop1.ITEM ) end end
Instead of linking by ITEM in SPLIT_JOB, link by JOB. Then you can get ITEM and SERVICE without having to create multiple links.
You can also make SPLIT_JOB a child of JOB, maybe call it OWNERSHIP_SPLIT and create a record for each owner so you can do the ownership math there.
Just thinking out loud, but maybe you want Price in JOB to be a number field that the data is copied over from ITEM but allows you to change it per job and will not update when you change the price next year or two years. This could also apply to other data that you want static per job.
May I ask why CONDO is linked in Jobs not in Service? Seems like you create a Service record, record the date and condo that needs the service then add the jobs related to that service.
-
You can put the code of the button in the Trigger after update in the ITEM field in JOB or in the Trigger on new record for the JOB table (if you move CONDO to Service).
Content aside
- Status Answered
- 1 yr agoLast active
- 4Replies
- 81Views
-
2
Following