I have a command handler and inside the uExecute method I perform an asynchronous call to a server module for data.
If I don't specify any additional GoToBusy/Free state commands, a brief "loading" shroud covers the filter and instance list, then the command handler is shown, then my data is populated on screen.
There is a very noticeable delay between the command handler showing and the data showing.
To rectify that, I tried putting the the GoToBusy/Free state commands at the appropriate points (similar to the Filter) but it appears to have no effect. Is that the expected behavior? Am I putting the state commands in the wrong place?
Here is the execute method.
Code: Select all
mthroutine name(uExecute) options(*REDEFINE)
define_com class(#PRIM_BOLN) name(#returnCode)
define_com class(#VF_LM003O) name(#dataItem) reference(*DYNAMIC)
* Define the data service
define_com class(#CMGCCPServerModule.GetSummary) name(#summary)
* Clear any previous messages
#avFrameworkManager.avClearMessages requester(#COM_OWNER)
* Do any execution logic defined in the ancestor
#COM_ANCESTOR.uExecute gotofreestate(#GotoFreeState) switchcallerreference(#SwitchCallerReference)
group_by name(#dataFields) fields(#CLDFB #l_LastBillDate #l_PreviousBillDate)
#dataItem <= #COM_OWNER.avAssociatedInstance
if (#dataItem *IsNot *NULL)
#ListManager.GetIdentifiers( #dataItem #CLOFID #CLOCN #CLOD )
#COM_OWNER.avGotoBusyState showbusytext("**************** LOOK AT ME *********************") animated(False)
* Get the data from the server by doing a asynchronous call to the Data service Server Module
#avFrameworkManager.avRecordTrace component(#COM_OWNER) event("Executing GetSummary")
#summary.ExecuteAsync officenumber(#CLOFID) controlnumber(#CLOCN) departmentcode(#CLOD) summaryfields(#dataFields)
else
#avFrameworkManager.avIssueMessage text('No current item found') requester(#COM_OWNER)
endif
* Button will be enabled when a field is changed
#SaveButton.Enabled := False
evtroutine handling(#summary.Completed)
#avFrameworkManager.avRecordTrace component(#COM_OWNER) event("GetSummary Completed")
#STD_DATEX := #CLDFB.AsDate( CCYYMMDD )
#FirstBillDate := #STD_DATEX.AsDisplayString( MMsDDsCCYY )
#STD_DATEX := #l_LastBillDate.AsDate( CCYYMMDD )
#LastBillDate := #STD_DATEX.AsDisplayString( MMsDDsCCYY )
#STD_DATEX := #l_PreviousBillDate.AsDate( CCYYMMDD )
#PreviousBillDate := #STD_DATEX.AsDisplayString( MMsDDsCCYY )
* if no data, then issue message
* #avFrameworkManager.avIssueMessage text('Not found on Server') requester(#COM_OWNER)
#COM_OWNER.avGotoFreeState
endroutine
evtroutine handling(#summary.Failed) reason(#reason) handled(#handled)
#avFrameworkManager.avRecordTraceAValue component(#COM_OWNER) event("GetSummary Failed") avalue(#reason)
* stop the event from bubbling up
#handled := True
#avFrameworkManager.avIssueMessage text('Could not retrieve data from server') requester(#COM_OWNER)
endroutine
endroutine