Filling the list

The FinishRefreshProcedureBackground completes the process of filling the transaction list when the list is filled in the background. This procedure will be called by the Refresh procedure, which will be added next. The following script is the FinishRefreshProcedureBackground for the Contant History list.

inout ListObjState list_object;
inout long nRecCount;
in boolean fResetRange;

if fResetRange then
	clear table(list_object:'Table Reference'); 
	{ need to reset the range on the temp table }
	call SetRange of form ListObj_ContactHistoryTrx, list_object;
end if;

{Display number of records in the list.}
nRecCount = countrecords(table(list_object:'Table Reference'));
field(list_object:RecCountStringRef) = str(nRecCount) + CH_SPACE + "Customers";

The Refresh procedure controls the process of displaying or updating the data displayed in the list. The type of action to be performed is passed into this procedure. The procedure must set the range options appropriately, and call the other procedures that are used during the display process.

The following is the Refresh procedure for the Contact History list.

inout ListObjState list_object;
in integer nRefreshType;
in string sSortColFieldName; {technical name of the field to sort by}
in integer nSortOrder; {sort order - ascending or descending}

local integer nStatus;
local long nRecCount;
local boolean fReloadData, fResetRange, fGetNewIndex;
local boolean fDatesOutOfTempTableRange;

default window to State;

fDatesOutOfTempTableRange = (list_object:'Start Date' <  '(L) TempTableStartDate') or ((list_object:'Start Date' > '(L) TempTableEndDate') and (not empty('(L) TempTableEndDate'))) or ((list_object:'End Date' > '(L) TempTableEndDate') and (not empty('(L) TempTableEndDate'))) or ((list_object:'End Date' < '(L) TempTableStartDate') and (not empty(list_object:'End Date')));
case nRefreshType
	in [REFRESHTYPE_CHANGESORT]
		fReloadData = false;
		fResetRange = false;
		fGetNewIndex = true;
	in [REFRESHTYPE_RELOAD]
		fReloadData = true;
		fResetRange = true;
		fGetNewIndex = true;
	in [REFRESHTYPE_FIND]
		fReloadData = false;
		fResetRange = true;
		fGetNewIndex = false;
	in [REFRESHTYPE_RESTRICT]
		fReloadData = false;
		fResetRange = true;
		fGetNewIndex = false;
else { refresh type is invalid, so do nothing }
		fReloadData = false;
		fResetRange = false;
		fGetNewIndex = false;
end case;

{Change index/key if necessary}
if fGetNewIndex then
	call GetSortIndex of form ListObj_ContactHistoryTrx, list_object, sSortColFieldName, nSortOrder;
end if;

field(list_object:RecCountStringRef) = getmsg(5965); {Processing...}

if fReloadData then
	{Clear/truncate the temp table}
	range clear table(list_object:'Table Reference');
	nStatus = Table_Truncate(table(list_object:'Table Reference'));
	assert nStatus = OKAY;

	'(L) TempTableStartDate' = list_object:'Start Date';
	'(L) TempTableEndDate' = list_object:'End Date';

	nRecCount = 0;

	call with name list_object:OpenWindowCallBackScript in dictionary DYNAMICS;
	call  background LoadDataBackground of form ListObj_ContactHistoryTrx, list_object, nRecCount;
end if;

if RunRefreshInBackground(list_object) of form syListObj then
	call background FinishRefreshBackground of form ListObj_ContactHistoryTrx, list_object, nRecCount, fResetRange;
else
	call FinishRefreshBackground of form ListObj_ContactHistoryTrx, list_object, nRecCount, fResetRange;
end if;


Documentation Feedback