Master / Detail | sc_master_value() not working when called from onAfterInsert

Hi,

I believe that I may have found a bug (SC 8.1.025).

I have two forms configured in single record mode. On is the master from and the other is the detail form.

When adding new items to the detail form I am trying to use the onAfterInsert event to total the items on the detail form and post the results back to the master form, but it isn’t working. The event fires but sc_master_value() does nothing.

Interestingly, sc_master_value() does work when called from the onAfterUpdate event.

Could someone please verify this as a bug?

Thanks,

Mike

Try to var_dump / echo or something to be sure the value you try to update. AfterInsert don’t knows about the fields entered in form IIRC

Hi,

I’ve tried echoing the values to screen and they are correct. Also, it’s the same PHP function that I’m using to total the values on insert, update and delete, so you’d expect it to be wrong in all three places if it was a problem with the totalling logic. I’ve also just noticed that sc_master_value() doesn’t seem to be working for onAfterDelete either.

As a last resort I have tried calling sc_master_value(fieldname, 123.456); manually in each of the three events (no other code) and the behaviour is that it works for onAfterUpdate, but not for onAfterDelete or onAfterInsert. It does look like a bug to me…

If anyone else could try recreating this I’d appreciate it as it’s driving me crazy!

Thanks,

Mike

[SIZE=12px]Hi,

Thanks for your response.

I have done some more testing and it does appear to be a bug. Behavior is as follows…

Master form is configured in Single Record format.

If the detail form is in single record format the onAfterInsert & onAfterDelete events fire but the sc_master_value() macro does nothing and no update is performed on the master application field(s). Interestingly, onAfterUpdate seems to work correctly.

From my testing the problem does not seem to occur when the detail form is configured in “Multiple Records”, “Editable Grid” or “Editable Grid View” mode.

So to recap, the problem seems to occur when the detail form is in “Single Record” format. If someone from Netmake could take a look at this as it’s causing us major problems.

Thanks,

Mike[/SIZE]

You are right. Moving to bugs subforum