E9.1 Enter a new Effective From and Thru Date on a grid but the previous Thru date needs to change.

FrankCLT

Well Known Member
Hi All,

Thread title a bit confusing but let me explain. I have a grid like below.

Line 1Item#BranchUOMEffective FromEffective Thru
112350EA3/7/202312/31/2049
If say I entered another entry line 2 as below with a different effective from date:
Line 1Item#BranchUOMEffective FromEffective Thru
112350EA3/7/202312/31/2049
212350EA5/20/202312/31/2049
I would like line 1 to display as follows: The effective thru for line 1 should be 1 day less than the effective from...from line 2.
Line 1Item#BranchUOMEffective FromEffective Thru
112350EA3/7/20235/19/2023
212350EA5/20/202312/31/2049



I'm kind of stumped on the logic of reading through the grid checking dates and making the appropriate changes. This could be done after the OK button and displayed once they went back into the app.

Thank you,
FrankCLT
 
I did something like this recently with F41061.
Trick is it's hard to read through the Grid so I wrote them all to a workfile then read them before user clicks OK. OK is disabled until I am happy/user clicks a validate button and I read back through the grid and linked worktable.
Hang on, let me dig out the code

Row exit & changed inline event:
Perform your validation and write the columns to a work table.
Read through each grid record and said worktable on ascending index on ITM MCU UOM and Effective From.
Ask if you can find a matching worktable record on ITM MCU UOM with an effective from date GE to the records Effective Thru you are on.
If you do you need to alter the previous records effectiove from to match your currents effective thru by - day, update the worktable

Very tricky to do as you will also want to update the old GC and it is very inefficient.
So I disabled the OK and forced the user to click a Validate button. If no errors are found it enables the OK.

The worktable is then read at the end of the OK to move them from F5741061 to F41061.
If a user clicks cancel I delete the worktable.
If a users session crashes, the worktable records are auto entered as processed anyway and will not be picked up by another session. I wrote a UBE to clear down old records
 
I was\am working on something similar, mine however uses a BSFN on the Post Commit event rule. The BSFN will begin by writing data from my worktable to an array and then I process the array backwards. I will take the last records Effective From Date subtract 1 day and make that the Expiration Date for the previous record in the array element and update the actual file from the array.

It works but seems like things can go south in a hurry.

Thanks,
FrankCLT
 
Back
Top