Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

[ Image Removed |../../index.htm#lansa/wamengt4_0375.htm]
You are here:

...

WAM060 - Employee Maintenance using Advanced Weblets
In this step you will extend the WebRoutine Details to insert a new employee skill.

...

     Your new code should look like the following:
* add new top row to skills list When (= N) #skl_list := *default Add_Entry To_List(#empskls) After(*START) Message Msgtxt('Complete new skill in the first list entry')
 
6.  When processing a list entry, a value of zero for Date Acquired (DATEACQR) means the entry is new.
     Add the following new logic to the CASE loop, for when STDRENTRY = S.
     New code is shown in red.
When (= S) Selectlist Named(#empskls) If (#dateacqr *NE *zeroes) Update Fields(#empskls) In_File(pslskl) With_Key(#empno #skilcode) Val_Error(*next) Else Insert Fields(#empskls) To_File(pslskl) Val_Error(*next) Endif Endselect If_Status Is(*okay) Message Msgtxt('Skills for '  #empno  ' were changed') Endif
 
7.  Create a method routine BuildSkills to populate the skills list SKILLS.
a.  Clear the list SKILLS
b.  Select all records from file SKLTAB and add entries to list SKILLS
c.  Position to the first entry
     Your code should look like the following:
Mthroutine Name(BuildSkills) Clr_List Named(#skills) Select Fields(#skills) From_File(skltab) Add_Entry To_List(#skills) Endselect Get_Entry Number(1) From_List(#skills) Endroutine  
8.  Add an output web_map for the SKILLS list to the Details WebRoutine as JSON data. Your code should look like the following:
Web_Map For(*output) Fields((#skills *JSON))
9.  Invoke the BuildSkills method at the end of the Details WebRoutine. Your code should look like the following. New code is shown in red.
Endcase
#com_owner.BuildSkills
Endroutine
 
10. Compile your WAM.
11. Open the Details WebRoutine in the Design view.
12.  Select the Skills tab, and select the Grid weblet. On the Details tab use the Ellipsis button for the grid_col_properties value to open the Design of …. dialog. With SKILCODE field selected, select the Customize Column check box and then click OK to close the dialog.

13. Drop a Dynamic select box into the Skill Code column. See the image below showing how the editor will highlight the column when the cursor is in the correct position.

     Adjust the width of the dropdown so that it can display skill description.
14. Select the Dynamic select box and set up its properties as shown:

Property

Value

listName

SKILLS

codeField

SKILCODE

captionField

SKILDESC

 |
15. Add a push button with image weblet into the into the single row table below the grid. Set up the button properties as:

Property

Value

caption

New Skill

left_relative_image

icons/normal/16/contract_16.png

on_click_wrname

Details

submitExtraFields

Field Name: STDRENTRY

 


Literal Value: N

 |
     Adjust the width of the push button to display the caption as single line.    
     Remove the place holder characters from table cell.
16. Select the Details tab page and then Save your changes. Your Skills tab page should look like the following:

17. Retest your WAM. Select an employee and select the Skills tab. The Dynamic select box for skills should display the correct skill description in each row.

  • Click the New Skill button to add a new row at the top of the skills grid.
  • Select a skill and complete the grade, comment and date acquired column. Note that the date acquired is a six digit date in the format DD/MM/YY.
  • Click the Save button to process the skills in the EMPSKLS list and update or insert to the employee skills file.
  • Validation errors will display messages at the top of the page.

...