Page 1 of 1
Cannot read property 'mthREMOVEFIRST' of null
Posted: Fri Sep 21, 2018 6:46 am
by eddie9394
I am trying to close the framework command window after a delete operation. I had tried #COM_Owner, #COM_Self and #COM_Ancestor avCloseForm. All yield to the same error message below:
Fatal Error:
Cannot read property 'mthREMOVEFIRST' of null
Location:
Reusable Part: CMGEXCDetailCommand, line 945
Call Stack:
1. Evtroutine Handling(#zInt_AyncOperationsTimer.Tick): CMGEXCDetailCommand, line 945
Reported By:
http://localhost:8080/LANSA/SYS/VLFONE_Engine.js, line 572:315
Any suggestion?! THANKS!
Re: Cannot read property 'mthREMOVEFIRST' of null
Posted: Fri Sep 21, 2018 8:34 am
by MarkD
Could you post your command handler code in text file?
Re: Cannot read property 'mthREMOVEFIRST' of null
Posted: Sat Sep 22, 2018 12:42 am
by eddie9394
Mark, Thank you for the reply. I created a simple command with just one button and the avCloseForm works fine, so something in my code is causing the issue. Here is my code please shine some light to it. Again THANK YOU!
function options(*direct)
begin_com role(*EXTENDS #MGSCommand) height(521) width(793) layoutmanager(#Layout3) verticalscroll(True)
* ================================================================================
* LAYOUT
* ================================================================================
define_com class(#PRIM_TBLO) name(#Layout)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn1) displayposition(1) parent(#Layout)
define_com class(#PRIM_TBLO.Row) name(#LayoutRow1) displayposition(1) parent(#Layout)
define_com class(#PRIM_TBLO) name(#Layout1)
define_com class(#PRIM_TBLO.Column) name(#Layout1Column1) displayposition(1) parent(#Layout1)
define_com class(#PRIM_TBLO.Row) name(#Layout1Row1) displayposition(1) parent(#Layout1)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item1) column(#Layout1Column1) manage(#CECLNAM) parent(#Layout1) row(#Layout1Row1) sizing(FitToWidth) flow(Down) alignment(TopLeft)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item2) column(#Layout1Column1) manage(#CELAMT) parent(#Layout1) row(#Layout1Row1) sizing(FitToWidth) flow(Down) alignment(TopLeft)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item3) column(#Layout1Column1) manage(#CEDAYS) parent(#Layout1) row(#Layout1Row1) sizing(FitToWidth) flow(Down) alignment(TopLeft)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item4) column(#Layout1Column1) manage(#CEDESC) parent(#Layout1) row(#Layout1Row1) sizing(FitToWidth) flow(Down) alignment(TopLeft)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item5) column(#Layout1Column1) manage(#wk_string6) parent(#Layout1) row(#Layout1Row1) sizing(FitToWidth) flow(Down) alignment(TopLeft)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item6) column(#Layout1Column1) parent(#Layout1) row(#Layout1Row1) manage(#SaveButton) sizing(None) flow(Down) alignment(TopLeft)
* ================================================================================
* UI COMPONENTS
* ================================================================================
define_com class(#PRIM_TBLO.Item) name(#Layout1Item7) column(#Layout1Column1) manage(#DeleteButton) parent(#Layout1) row(#Layout1Row1) sizing(None) alignment(TopCenter)
define_com class(#PRIM_TBLO) name(#Layout2)
define_com class(#PRIM_TBLO.Column) name(#Layout2Column1) displayposition(1) parent(#Layout2)
define_com class(#PRIM_TBLO.Row) name(#Layout2Row1) displayposition(1) parent(#Layout2)
define_com class(#PRIM_TBLO) name(#Layout3)
define_com class(#PRIM_TBLO.Column) name(#Layout3Column1) displayposition(1) parent(#Layout3)
define_com class(#PRIM_TBLO.Row) name(#Layout3Row1) displayposition(1) parent(#Layout3) height(340) units(Pixels)
define_com class(#PRIM_TBLO.Row) name(#Layout3Row2) displayposition(2) parent(#Layout3) units(Pixels) height(100)
define_com class(#PRIM_TBLO.Item) name(#Layout3Item1) manage(#CECLNAM) parent(#Layout3) row(#Layout3Row1) sizing(FitToWidth) column(#Layout3Column1) alignment(TopLeft) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#Layout3Item2) manage(#CELAMT) parent(#Layout3) row(#Layout3Row1) sizing(FitToWidth) column(#Layout3Column1) alignment(TopLeft) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#Layout3Item3) manage(#CEDESC) parent(#Layout3) row(#Layout3Row1) sizing(FitToWidth) column(#Layout3Column1) alignment(TopLeft) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#Layout3Item4) manage(#CEDAYS) parent(#Layout3) row(#Layout3Row1) sizing(FitToWidth) column(#Layout3Column1) alignment(TopLeft) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#Layout3Item5) manage(#DeleteButton) parent(#Layout3) row(#Layout3Row2) sizing(None) column(#Layout3Column1) alignment(TopRight) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#Layout3Item6) manage(#wk_string6) parent(#Layout3) row(#Layout3Row1) sizing(FitToWidth) column(#Layout3Column1) alignment(TopLeft) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#Layout3Item7) alignment(TopLeft) column(#Layout3Column1) manage(#SaveButton) parent(#Layout3) row(#Layout3Row2) sizing(None)
define_com class(#CECLNAM.EditField) name(#CECLNAM) displayposition(1) left(0) parent(#COM_OWNER) tabposition(1) top(0) width(793) readonly(True) height(65)
define_com class(#CELAMT.EditField) name(#CELAMT) displayposition(2) left(0) parent(#COM_OWNER) tabposition(2) top(65) width(793) height(65)
define_com class(#CEDAYS.EditField) name(#CEDAYS) displayposition(3) left(0) parent(#COM_OWNER) tabposition(3) top(130) width(793) height(65)
define_com class(#CEDESC.EditField) name(#CEDESC) displayposition(4) left(0) parent(#COM_OWNER) tabposition(4) top(195) width(793) caption('Special Consideration Description') captiontype(Caption) height(65)
define_com class(#wk_String6.EditField) name(#wk_string6) displayposition(5) left(0) parent(#COM_OWNER) tabposition(5) top(260) width(793) readonly(True) caption('Effect Date') captiontype(Caption) height(65)
define_com class(#PRIM_MD.RaisedButton) name(#SaveButton) caption('Save') displayposition(7) left(0) parent(#COM_OWNER) tabposition(7) height(39) width(118) enabled(False) top(340) themedrawstyle('MediumTitle')
define_com class(#PRIM_MD.RaisedButton) name(#DeleteButton) caption('Delete') displayposition(6) left(665) parent(#COM_OWNER) tabposition(6) height(41) width(128) top(340) themedrawstyle('MediumTitle')
define_com class(#MGSConfirmDialog) name(#MGSConfirmDialog)
def_list name(#ClientList) fields(#wk_CountryCode #CEOFF #CECLNBR #CECLNAM #CEDESC #CEDAYS #CELAMT #CEEDTE) counter(#LISTCOUNT) type(*working) entrys(*max)
* ================================================================================
* FIELDS
* ================================================================================
* group_by name(#DisplayFields) fields(#CECLNAM #CEDESC #CEDAYS #CELAMT #CEEDTE)
* group_by name(#SaveFields) fields(#CEDESC #CEDAYS #CELAMT)
* ================================================================================
* COMPONENTS
* ================================================================================
define_com class(#CMGEXCObjectManager) scope(*application)
define_com class(#CMGEXCDataObject) name(#ListItem) reference(*dynamic)
define_com class(#CMGEXCDetailsModule.Get) name(#Get)
define_com class(#CMGEXCDetailsModule.Save) name(#Save)
* ================================================================================
* ROUTINES
* ================================================================================
* ================================================================================
* ROUTINES
* ================================================================================
mthroutine name(uInitialize) options(*redefine)
* Do any initialization defined in the ancestor
#COM_ANCESTOR.uInitialize
#CMGEXCObjectManager.Register command(#COM_OWNER)
* Build collection of Editable fields
#COM_SELF.CollectEditableControls( #COM_OWNER.ComponentControls )
#SaveButton.Enabled := False
endroutine
mthroutine name(uTerminate) options(*redefine)
#CMGEXCObjectManager.Deregister command(#COM_OWNER)
#COM_SELF.ClearEditableControls
* Do any termination defined in the ancestor
#COM_ANCESTOR.uTerminate
endroutine
evtroutine handling(#COM_OWNER.FieldsChanged)
#SaveButton.Enabled := True
endroutine
mthroutine name(avExecuteAsyncOperation) options(*redefine)
case of_field(#OperationID.UpperCase)
when (= GET)
#wk_CountryCode := #ListItem.CountryCode
#CEOFF := #ListItem.OfficeNumber
#CECLNBR := #ListItem.ClientNumber
#Get.Execute returnfields(#ClientList) status(#wk_Status)
when (= SAVE)
#COM_SELF.ClearProblemHighlights
#Save.Execute filefields(#ClientList) status(#wk_Status)
endcase
endroutine
mthroutine name(uExecute) options(*redefine)
* Clear any previous messages
#avFrameworkManager.avClearMessages requester(#COM_OWNER)
#GotoFreeState := false
* Do any execution logic defined in the ancestor
#COM_ANCESTOR.uExecute gotofreestate(#GotoFreeState) switchcallerreference(#SwitchCallerReference)
if (#COM_OWNER.avAssociatedInstance *IsNot *NULL)
* Get the selected list item and country code from the ListManager
#ListItem <= #CMGEXCObjectManager.GetItem( #COM_OWNER.avAssociatedInstance )
#COM_OWNER.avQueueAsyncOperation busystatetext('Loading') operationid(GET)
else
#avFrameworkManager.avIssueMessage text('No current item found') requester(#COM_OWNER)
endif
endroutine
evtroutine handling(#Get.Completed)
if (#wk_Status = OK)
#wk_string6 := #CEEDTE.AsDate( CCYYMMDD ).AsDisplayString( MMsDDsCCYY )
#SaveButton.Enabled := False
#DeleteButton.Enabled := True
endif
endroutine
evtroutine handling(#Get.Failed) handled(#pHandled) reason(#pReason)
#pHandled := True
#avFrameworkManager.avRecordTraceAValue component(#COM_OWNER) event('GET Failed') avalue(#pReason)
endroutine
evtroutine handling(#SaveButton.Click)
#COM_OWNER.avQueueAsyncOperation busystatetext('Saving') operationid(SAVE) receivesystemmessages(False)
endroutine
evtroutine handling(#MGSConfirmDialog.Button1Clicked)
#CECLNAM := "***DELETE***"
#CEDAYS := 999
#CELAMT := 0
#CEDESC := ""
#wk_string6 := ""
#COM_OWNER.avQueueAsyncOperation busystatetext('Saving') operationid(SAVE) receivesystemmessages(False)
endroutine
evtroutine handling(#DeleteButton.Click)
#MGSConfirmDialog.ShowDialogBox( "Confirm Delete?!" "Yes" "No" )
endroutine
evtroutine handling(#save.Completed)
#avFrameworkManager.avRecordTraceAValue component(#COM_OWNER) event('Save Completed') avalue(#wk_Status)
if (#wk_Status = OK)
#SaveButton.Enabled := False
if (#CECLNAM *EQ "***DELETE***")
* Delete Complete
#avFrameworkManager.avIssueMessage autoclear(True) requester(#COM_OWNER) clearexistingmessages(True) text('Delete Completed Successfully') tomainform(False)
#DeleteButton.Enabled := False
* #COM_OWNER.avCloseForm
else
* Save Completed
#avFrameworkManager.avIssueMessage autoclear(True) requester(#COM_OWNER) clearexistingmessages(True) text('Save Completed Successfully') tomainform(False)
endif
#CMGEXCOBJECTMANAGER.RefreshInstanceList
else
#COM_SELF.HighlightProblems
endif
endroutine
evtroutine handling(#Save.Failed) handled(#pHandled) reason(#pReason)
#avFrameworkManager.avRecordTraceAValue component(#COM_OWNER) event('Save Failed') avalue(#pReason)
#pHandled := True
endroutine
end_com
Re: Cannot read property 'mthREMOVEFIRST' of null
Posted: Sat Sep 22, 2018 5:42 am
by eddie9394
Re: Cannot read property 'mthREMOVEFIRST' of null
Posted: Mon Sep 24, 2018 4:35 pm
by MarkD
So did you trigger its execution on a short delay timer?
Re: Cannot read property 'mthREMOVEFIRST' of null
Posted: Mon Sep 24, 2018 11:43 pm
by eddie9394
Yes, did it with a timer. THANKS for your support!
Re: Cannot read property 'mthREMOVEFIRST' of null
Posted: Fri Sep 28, 2018 4:58 pm
by MarkD
This will be simple in the next version ...............
#Com_Owner.avCloseForm has new optional Delay() parameter
The Delay() parameter may be used to delay the close operation to allow already stacked or scoped operations to completed first.
The value specified is in milliseconds. The default value is Delay(0). Values <= 0 mean no delay is used.