Page History
...
* Update the instance list using the "quick update" method
Use Builtin(BConcat) With_Args(#GiveName #SurName) To_Get(#FullName)
Invoke Method(#avListManager.UpdateListEntryData) Akey1(#Deptment) Akey2(#Section) Akey3(#Empno) Visualid2(#FullName) Acolumn1(#Phonehme) Acolumn2(#Address1) Ncolumn1(#PostCode) Businessobjecttype(EMPLOYEES)
* Disable the save button again
...
Set Com(#SAVE_BUTTON) Enabled(False)
...
* Drop the framework lock as no updates are outstanding now
...
Set Com(#avFrameworkManager) Ulocked(FALSE)
...
Otherwise
...
Use Builtin(message_box_show) With_Args(ok ok info *component ('Unknown ForAction>>' + #ForAction.Value + '<<'))
Endcase
...
Set Com(#myscreen_wrapper) Visible(False)
Endroutine
...
* Traverse the skills subfile/browselist by column name
Mthroutine Name(uGetSkills)
...
Define_Map For(*input) Class(#vf_eltxtl) Name(#GridName)
Define_Map For(*input) Class(#vf_eltxtl) Name(#nxtpage) Mandatory('+')
...
Define Field(#colcount) Type(*dec) Length(2) Decimals(0)
Define Field(#rowcount) Type(*dec) Length(4) Decimals(0)
Define Field(#column) Type(*dec) Length(2) Decimals(0) Default(0)
Define Field(#row) Type(*dec) Length(2) Decimals(0) Default(0)
Define Field(#colname) Type(*char) Length(50)
Define Field(#headrows) Type(*dec) Length(2) Decimals(0) Default(0)
...
Clr_List Named(#skills)
...
Dowhile (#nxtpage *NE '')
...
* Get the total number of subfile rows
#myscreen_wrapper.getvalue From(#GridName.value + ".RowCount") Value(#rowcount)
* Get the total number of subfile heading rows
#myscreen_wrapper.getvalue From(#GridName.value + ".HeadRows") Value(#headrows)
...
* Subtract one because the row collection is zero based.
#rowcount -= 1
...
Begin_Loop Using(#row) From(#headrows) To(#rowcount)
...
* get the number of subfile colums
#myscreen_wrapper.getvalue From(#GridName.value + ".Columns.Count") Value(#colcount)
...
Begin_Loop Using(#column) To(#colcount)
* get the column name. Use a method to make the code easier to read
#com_owner.uGetColName Ugridname(#GridName.value) Ucolnumber(#column) Ucolname(#colname)
...
* for the appropiate column, get the cell value
Case (#colname)
When Value_Is(= 'DateSklAcquired')
#com_owner.uGetCellValue Ugridname(#GridName.value) Ucolnumber(#column) Urownumber(#row) Ucellvalue(#vf_eltxts)
When Value_Is(= 'SkillCode')
#com_owner.uGetCellValue Ugridname(#GridName.value) Ucolnumber(#column) Urownumber(#row) Ucellvalue(#skilcode)
When Value_Is(= 'SkillDescription')
#com_owner.uGetCellValue Ugridname(#GridName.value) Ucolnumber(#column) Urownumber(#row) Ucellvalue(#skildesc)
When Value_Is(= 'Comment')
#com_owner.uGetCellValue Ugridname(#GridName.value) Ucolnumber(#column) Urownumber(#row) Ucellvalue(#comment)
When Value_Is(= 'Grade')
#com_owner.uGetCellValue Ugridname(#GridName.value) Ucolnumber(#column) Urownumber(#row) Ucellvalue(#grade)
Endcase
...
End_Loop
...
* Sometimes newlook treats rows without data as valid rows so add only the ones where at least one field has data
If_Null (#skilcode #skildesc #comment #grade)
Else
Add_Entry To_List(#skills)
Endif
...
End_Loop
...
* If there is another page, page down
#myscreen_wrapper.getvalue From(#GridName.value + ".Marker") Value(#nxtpage.value)
If (#nxtpage.value *NE '')
#myscreen_wrapper.sendkey Key(#myscreen_wrapper.KeyPageDown)
Endif
...
Endwhile
...
Endroutine
...
Mthroutine Name(uGetColName)
Define_Map For(*input) Class(#vf_eltxtl) Name(#uGridName)
Define_Map For(*input) Class(#vf_elnum) Name(#uColNumber)
Define_Map For(*output) Class(#vf_eltxtl) Name(#uColName)
...
* The column collection is zero based but Begin Loop must start at minimum of 1.
#ucolnumber -= 1
#myscreen_wrapper.getvalue From(#uGridName.value + ".Columns(" + #uColNumber.asstring + ").Name") Value(#ucolname.value)
Endroutine
...
Mthroutine Name(uGetCellValue)
Define_Map For(*input) Class(#vf_eltxtl) Name(#uGridName)
Define_Map For(*input) Class(#vf_elnum) Name(#uColNumber)
Define_Map For(*input) Class(#vf_elnum) Name(#uRowNumber)
Define_Map For(*output) Class(#vf_eltxtl) Name(#uCellvalue)
...
* The column collection is zero based but Begin Loop must start at minimum of 1.
#ucolnumber -= 1
#myscreen_wrapper.getvalue From(#uGridName.value + ".Columns(" + #uColNumber.asstring + ").Cells(" + #uRowNumber.asstring + ").Text") Value(#ucellvalue.value)
Endroutine
...
* Listen to messages from RAMP and the 5250 application
Evtroutine Handling(#myscreen_wrapper.RampMessage) Umessagetype(#MsgType) Umessagetext(#MsgText)
...
Case (#msgtype.value)
...
When Value_Is('= VF_ERROR')
* Fatal messages reported by Ramp (e.g. Navigation request failed, etc). If in design mode, show the underlying newlook screen. Otherwise, make the error message
* appear in a message box on top of the command
If (#usystem.iDesignMode = true)
Set Com(#myscreen_wrapper) Visible(True)
Else
Message Msgid(dcm9899) Msgf(dc@m01) Msgdta(#msgtext.value)
#com_owner.avshowmessages
Endif
...
* Messages sent by the IBM i application or unknown form was encountered
When Value_Is('= VF_INFO' '= VF_UNKNOWN_FORM')
...
Message Msgid(dcm9899) Msgf(dc@m01) Msgdta(#msgtext.value)
...
* Failure to initialize RAMP. Could occur for mainly one of two reasons
When Value_Is('= VF_INIT_ERROR')
...
Message Msgid(dcm9899) Msgf(dc@m01) Msgdta(#msgtext.value)
#com_owner.avshowmessages
...
When Value_Is('= VF_WAITCONNECTION')
...
Otherwise
Use Builtin(message_box_show) With_Args(ok ok info *Component ('Unknown message type ' + #MsgType + 'encountered'))
Endcase
...
Endroutine
...
* --------------------------------------------------------------------------------
* Handle changes in any of the fields on the panel
* --------------------------------------------------------------------------------
...
Evtroutine Handling(#PanelFields<>.Changed)
...
* Enable the save button
...
Set Com(#SAVE_BUTTON) Enabled(True)
...
* Lock the framework and set a message for the user
...
Use Builtin(bconcat) With_Args('Changes made to employee' #GiveName #Surname 'have not been saved yet.' 'Do you want to save them before continuing?') To_Get(#sysvar$av)
...
Set Com(#avFrameworkManager) Ulocked(USER) Ulockedmessage(#sysvar$av)
...
Endroutine
...
* --------------------------------------------------------------------------------
* Enter key pressed
* --------------------------------------------------------------------------------
...
Evtroutine Handling(#PanelFields<>.KeyPress) Options(*NOCLEARMESSAGES *NOCLEARERRORS) Keycode(#KeyCode)
...
If Cond('#KeyCode.Value = Enter')
...
* If there no changes have been made issue message and ignore enter
...
If Cond('#SAVE_BUTTON.Enabled *EQ True')
...
Invoke Method(#Com_Owner.Save)
...
Else
...
* Issue 'There are no changes to save' message
...
Use Builtin(Message_box_show) With_Args(ok ok Info *Component *MTXTDF_NO_SAVE)
...
Endif
...
Endif
...
Endroutine
...
* --------------------------------------------------------------------------------
* Handle the save button
- --------------------------------------------------------------------------------
Evtroutine Handling(#SAVE_BUTTON.Click)
- Call the Save method
Invoke Method(#Com_Owner.Save)
Endroutine
- --------------------------------------------------------------------------------
- Handle Save
- --------------------------------------------------------------------------------
Mthroutine Name(Save)
- Update data base
Invoke Method(#myscreen_wrapper.MakeRampAvailable) Foraction(UpdateDetails)
- If update completed okay
Endroutine
- --------------------------------------------------------------------------------
- Handle Termination
- --------------------------------------------------------------------------------
Mthroutine Name(uTerminate) Options(*REDEFINE)
- Clean up the colelction of fields on the panel
Invoke Method(#PanelFields.RemoveAll)
- Do any termination defined in the ancestor
Invoke Method(#Com_Ancestor.uTerminate)
Endroutine
End_Com