Updating Total (Like General Journal)

nick_robbonick_robbo Posts: 38Member
Hi,

I have a table with 3 fields, "Resource No." (PK), "Work Center No." (PK), "Time Split %" (Decimal).

I have a list page to display these fields, I have also updated the page to a Worksheet in order to try & solve this issue.

Really I am wanting to keep track of the Total "Time Split %". (So the sum of all "Time Split %" for that Resource).

This is to ensure it always adds up to 100%.

I would like to copy the functionality on the General Journal page, which keeps track of Balance & Total Balance.

I have a function in the page, called OnAfterGetCurrRecord called CalcTotal.

The function works when the page loads, and works when a value is updated...but only if the user uses the arrow keys
to go down/up on to another record.

In the General Journal, if you change the Amount field, and just use the left/right arrow key to move off the field to the right, it updates the Balance.
Is there anything I am missing?

Attached is a screenshot of the page etc.

xc12e096qi07.png

hx8y8dpoit5o.png

Answers

  • allenyyzhouallenyyzhou Posts: 59Member
    Hi,

    I think it is because when you did not move to another line, "Rec" has not been saved yet, so if you use another "ResourceWorkCenter" to CALCSUMS, you can only get old value.
    That is why in General Journal, they use Rec and xRec
    CalcBalance(Rec,xRec,Balance,TotalBalance,ShowBalance,ShowTotalBalance)

    Check what CalcBalance do and make a similar function should be fine.
  • nick_robbonick_robbo Posts: 38Member
    This is weird, but changing the Source Expression in the page to a function has solved the issue. Instead of using Rec - xRec in the Source Expression.
Sign In or Register to comment.