UPD_Entry changes field atributes to append

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
amadorsilvestre
Posts: 1
Joined: Tue Feb 07, 2017 6:53 am

UPD_Entry changes field atributes to append

Post by amadorsilvestre »

There is a list that has 3 columns that do a quick calculation and put the result into another column in that list.
The calc is triggered by a keypress or an enter key. The problem is, after the calc is done run UPD_Entry in the list and it updates everything.
During that update, it causes the new entry to the cell to be appended instead of replaced (clear and add).
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: UPD_Entry changes field atributes to append

Post by Stewart Marshall »

The Keypress event fires when the key is pressed and BEFORE the field values in the list are updated. This allows you to trap specific keys if required.

However, for the purposes of updating a total, it's best is to use the ItemChanged event. This fires after the underlying list values have been updated

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Width(817) Height(593)
Define_Com Class(#PRIM_LIST) Name(#List1) DisplayPosition(1) Left(16) Parent(#COM_OWNER) TabPosition(1) Top(8) Height(426) Width(537)
Define_Com Class(#PRIM_LIST.Number) Name(#ColumnSTD_QTY1) ColumnWidth(181) DisplayPosition(1) Increment(1) Parent(#List1) Source(#STD_QTY) Wrap(False) ColumnReadOnly(False) EditAlignment(Right) DisplayAlignment(Right)
Define_Com Class(#PRIM_LIST.Number) Name(#ColumnSTD_PRICE1) ColumnWidth(136) DisplayPosition(2) Increment(1) Parent(#List1) Source(#STD_PRICE) Wrap(False) ColumnReadOnly(False) DisplayAlignment(Right) EditAlignment(Right)
Define_Com Class(#PRIM_LIST.Number) Name(#ColumnSTD_AMNT1) ColumnWidth(148) DisplayPosition(3) Increment(1) Parent(#List1) Source(#STD_AMNT) Wrap(False) DisplayAlignment(Right) EditAlignment(Right)

Evtroutine Handling(#Com_owner.CreateInstance)

Inz_List Named(#List1) Num_Entrys(10)

Endroutine

Evtroutine Handling(#List1.ItemChanged)

#std_amnt := #Std_price * #Std_qty
Upd_Entry In_List(#List1)

Endroutine

End_Com
Regards
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
Post Reply