Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread AfterPost Event
Mon, Jan 11 2021 7:52 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Before I report it as  a bug, and because it may be my misunderstanding of when/how events fire


In a table AfterPost event I have some code which references the primary key of the table

dm.DB.Execute('UPDATE Ledger SET _fkSlips = ' + IntToStr(Slips_ID.AsInteger) + ', _fkBanks = ' + IntToStr(GetBankAccount.Tag) + ' WHERE _ID IN (' + RowList.CommaText + ')');

Unfortunately when the AfterPost event fires NONE of the fields in the Slips table seem to have been populated. Does this seem right?


Roy Lambert
Mon, Jan 11 2021 8:54 AMPermanent Link

Raul

Team Elevate Team Elevate

On 1/11/2021 7:52 AM, Roy Lambert wrote:
> In a table AfterPost event I have some code which references the primary key of the table
>
> dm.DB.Execute('UPDATE Ledger SET _fkSlips = ' + IntToStr(Slips_ID.AsInteger) + ', _fkBanks = ' + IntToStr(GetBankAccount.Tag) + ' WHERE _ID IN (' + RowList.CommaText + ')');
>
> Unfortunately when the AfterPost event fires NONE of the fields in the Slips table seem to have been populated. Does this seem right?

AfterPost AFAIK fires for given table after data is actually saved
available for use (and table would be in browser state again).

However, i'm bit confused about the SQL you're executing - it does not
reference Slips table at all  !?

Raul
Mon, Jan 11 2021 10:30 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Raul

>AfterPost AFAIK fires for given table after data is actually saved
>available for use (and table would be in browser state again).

Following much head scratching I've come to the conclusion that its, yet again, me. Its been a while since I've been working on this bit of code and I forgot I had a filter in place. As soon as its posted the record gets whisked away. I now have the fun of trying to find the right places to unfilter and refilter Frown


>However, i'm bit confused about the SQL you're executing - it does not
>reference Slips table at all !?


IntToStr(Slips_ID.AsInteger) <<<<<<<<<<<

Roy
Mon, Jan 11 2021 2:59 PMPermanent Link

Raul

Team Elevate Team Elevate

On 1/11/2021 10:30 AM, Roy Lambert wrote:
> Following much head scratching I've come to the conclusion that its, yet again, me. Its been a while since I've been working on this bit of code and I forgot I had a filter in place. As soon as its posted the record gets whisked away. I now have the fun of trying to find the right places to unfilter and refilter Frown

makes sense

>
> IntToStr(Slips_ID.AsInteger) <<<<<<<<<<<

Ok - that looks like a variable or maybe a field reference.

OP referenced "Slips table" so i was looking for table reference in the sql.

Raul

Image