on 03-05-2018 12:31 PM
Hello. Please help me on this problem which I have tried to fix for hours but failed.
I am doing a SetItem() on a field in itemchanged() event. The requirement is the field will always be 6 numeric characters. So if users types 11, on tab-out I am trying to set 0000 so the value becomes 110000.
During debug, I see the value 110000 being set in datawindow but when the execution goes to itemfocuschanged() event, the value automatically changes to 11.
Initially I thought the field is Char type so that may be a issue but its not. The behavior is same for Long type field also. I have also tried putting AcceptText() in the itemChanged() and ItemFocusChanged() Event but no sucess.
Below is my code in Itemchanged event():
ls_col_value = This.GetItemString(row,"col_name")//not mentioning actual column name due to security reasons//
IF Len(data) < 6 THEN
data = data + fill("0", 6 - Len(data))
This.SetItem(row, "col_name", data)
END IF
Try this ....
String ls_name
String ls_data
ls_name = String ( DWO.Name )
ls_data = Trim ( data )
Choose case ls_name
case "<your col name>"
IF Len ( ls_data ) < 6 then
data = ls_data + fill ( "0", 6 - Len ( ls_data ) )
END IF
end choose
Return 0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.