Event Routine Handling not responded to?

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Event Routine Handling not responded to?

Post by adale »

I hope I can explain this issue clearly enough, and one of the forum members can help explain what is happening.

I have a VL Dialog that is a list of items on an order.
When the dialog is initially displayed for a new order, there are no detail records.
I have an "Add item" button that calls the MTHROUTINE "AddNewDetail" to add new detail records to the order.
When the add detail record is complete, it triggers the signal event "ItemSaved".
In the MTHROUTINE, I have an eventroutine handling specific for the "ItemSaved" which clears the order list, prints out to the web console.log, and then calls the routine to refresh the order list and show the dialog.

Here is my issue:
When you first call the dialog with a new order, and add initial item(s), the dialog does not refresh? The write to the console.log doesn't happen? The detail items are correctly added to the order in the file, just the Event Handling of "ItemSaved" does not take place?

If you get out of the dialog, and then go back into the dialog, the item details that were added, do show correctly.

Now, upon going back into the dialog, if you add another new detail item, the dialog refreshes, the console.log gets written out, all as expected in the event handling of "ItemSaved".

Why does this not work, or respond on the initial use, but works fine on subsequence uses?

Code: Select all

* Add New Detail line record
MTHROUTINE Name(AddNewDetail)
* Call to Add New Line Detail - prompting dialog, item cat, then item.
DEFINE_COM Class(#P1MAddOrderDetail_Dialog) Name(#AddDetail)

#AddDetail.Refresh( #CENO #CELID #ORDN )

EVTROUTINE Handling(#AddDetail.Closed)
CLR_LIST Named(#ListDtl)
#COM_OWNER.ShowDetails( #CENO #CELID #ORDN #ORDNAM )
ENDROUTINE

EVTROUTINE Handling(#AddDetail.ItemSaved)
CLR_LIST Named(#ListDtl)

* Console - debug
#sys_web.Console.Log( ('LINE-#443 AddNewDetail: ' + ' - ' + #) )


#COM_OWNER.ShowDetails( #CENO #CELID #ORDN #ORDNAM )

* #SYS_WEB.Alert Caption('Item Added to Order.')
#Alert.Caption := 'Item Added to Order.'
#Alert.ShowAlert

ENDROUTINE

ENDROUTINE
Arlyn Dale
Servias LLC
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Event Routine Handling not responded to?

Post by adale »

To clarify:
When the Dialog is first called (presented) the dialog list is empty, and the MTHRoutine and Event Routine from the Add New is not yet triggered or executed.
Once the button is clicked to Add a new record, is the MTHRoutine (AddNewDetail) is executed.
It is in this first cycle or run of this MTHRoutine, where I am not seeing the ItemSaved event handling not responding, or not executing.
Even if multiple item records are added, as long as you do not back out of the Dialog (close button) the ItemSaved event handling does not happen.

Yet, if you close the dialog, then go back into the dialog and add an item (same MTHRoutine (AddNewDetail)) then the ItemSaved handling event triggers and executes as expected. Odd?
Arlyn Dale
Servias LLC
Post Reply