January 12, 2017

Today I am continuing work on the customer upgrade from yesterday and a simple routine is needed to insure the invoices selected do not exceed the check total for the batch. To do this we need two calculated fields and one variable variable field.

  • InvTTl
  • vCkTotal
  • xBalDue

InvTTl (total of all invoices selected) minus vCkTotal (Amonunt of Deposit) equals xBalDue

Normally you would add a calculated field to the form for total invoices but remember our parent table has over 80 thousand records and the totals for each record are driven by the values in the salsitms tbl over 250 thousand records. When entering the form, with all records selected the calculation would take too long to run. This is unacceptable. To overcome this I changed all three fields to variables and the calculation is completed only when the user clicks the button on the form. See below.

BatchPaymentform-01

Verify Batch List runs the following code

DIM SHARED records_found as N
records_found = topparent.queryrun(“del_quote = .t.”,””,””,”No”,”Sales”,.f.)
xbasic_wait_for_idle()
invttl.value = total(calc->Invtotbrws,grp->SALES)
xBalDue = vCkTotal – invttl.value
parentform.Refresh_Layout()

 

This code queries our list then runs our calculations on the variables using only the records in the browse list. When the user presses Process Batch Payment; if xBalDue is less than 0 the user is prompted to redo list selection.

if xBalDue < 0 then
goto nocando
end if

……….

nocando:
ui_msg_box(“Sorry”, “Your deposit will not cover all invoices selected. Please try again.”)

 

As I said, a simple solution.  Now you may say to yourself this is not necessary but in today’s age of instant everything no one wants to wait even for a minute to see what the want to see and if you want to impress your customer make each screen display as close to instant as possible. So if you have a form which takes too long to load due to calculated fields in the form then move them to variables. You will be amazed at the difference.

That’s all for today. If you are a business and need help with an Alpha Software program, contact us. Are rates are reasonable and our work is guaranteed.

Phone:713 417-6831

EMail: NLawson@cdc-takecharge.com