Hello
I am migrating a Form "Repayment Card" with Subform "subfrmRepaymentSchedule" from NAV4.1 to NAV2016. The subform data is based upon a Temporary Table "tmpPaymentForecast". I am getting an error:
"A transaction must be started before changes can be made to the database". When I debug the code, the error occurs on this line:
PaymentForecast..DELETEALL;
The Page/Sub Page is relationship is similar to this post:
mibuso.com/howtos/how-to-use-temporary-table-data-on-a-subform
Page - Repayment Card OnAfterGetRecord:
CurrPage.subfrmRepaymentSchedule.PAGE.GetSchedule(Rec);
Page - subfrmRepaymentSchedule:
Global Function: GetSchedule(Repayment);
Calls a Global function in a code unit:
ScheduleCalcs.BuildRepaymentSchedule(Repayment,tmpPaymentForecast);
CodeUnit ScheduleCalcs:
BuildRepaymentSchedule(VAR Repayment : Record "Repayment Plan";VAR PaymentForecastInput : Record "Payment Forecast")
//Assign the PaymentForecastInput Record to the local variable PaymentForecast
PaymentForecast.RESET;
PaymentForecast := SettlementPlanScheduleIn;
IF PaymentForecastInput.HASFILTER THEN
PaymentForecast.COPYFILTERS(PaymentForecastInput);
IF NOT PaymentForecast.ISEMPTY THEN
PaymentForecast.DELETEALL; ****This is where my error occurs.
Is this still the best approach in NAV2016? If not, what design should I use?
If it is the still the best approach, any ideas why I might be getting the error?
Many Thanks.
I am migrating a Form "Repayment Card" with Subform "subfrmRepaymentSchedule" from NAV4.1 to NAV2016. The subform data is based upon a Temporary Table "tmpPaymentForecast". I am getting an error:
"A transaction must be started before changes can be made to the database". When I debug the code, the error occurs on this line:
PaymentForecast..DELETEALL;
The Page/Sub Page is relationship is similar to this post:
mibuso.com/howtos/how-to-use-temporary-table-data-on-a-subform
Page - Repayment Card OnAfterGetRecord:
CurrPage.subfrmRepaymentSchedule.PAGE.GetSchedule(Rec);
Page - subfrmRepaymentSchedule:
Global Function: GetSchedule(Repayment);
Calls a Global function in a code unit:
ScheduleCalcs.BuildRepaymentSchedule(Repayment,tmpPaymentForecast);
CodeUnit ScheduleCalcs:
BuildRepaymentSchedule(VAR Repayment : Record "Repayment Plan";VAR PaymentForecastInput : Record "Payment Forecast")
//Assign the PaymentForecastInput Record to the local variable PaymentForecast
PaymentForecast.RESET;
PaymentForecast := SettlementPlanScheduleIn;
IF PaymentForecastInput.HASFILTER THEN
PaymentForecast.COPYFILTERS(PaymentForecastInput);
IF NOT PaymentForecast.ISEMPTY THEN
PaymentForecast.DELETEALL; ****This is where my error occurs.
Is this still the best approach in NAV2016? If not, what design should I use?
If it is the still the best approach, any ideas why I might be getting the error?
Many Thanks.