Step 1 Create Login Function

LANSA Web Functions

Step 1. Create Login Function

In this step, you will create a new process iiiPROC04 which contains a login function iiiFN10. The login function simply requests a user ID. (You will create a new field in the Repository for the login ID.) The login ID will be added to the STDHEADER so that it is displayed in each function. The login function will have a link to the iiiFN07 Display Sections function. The iiiFN07 function will be modified to check that a login has been entered. If no value has been entered, the iiiFN10 login will be called so that the user must be logged in to use iiiFN07.

1.  From the LANSA development environment, work with the fields in the LANSA Repository. Create a new field as follows:

Field Name

iiiLOGIN
(where iii is your course assigned ID)

Type

A

Length

10

Description

Login:

 

  

2.  Create a new LANSA process named iiiPROC04 Login Process, where iii is your course assigned ID. (If the process already exists, select a different set of characters for iii.)

3.   Enable your iiiPROC04 process for web. If you need to know how, refer to Web Enabling a LANSA Process.

4.  Working with your iiiPROC04 process, create a new function named iiiFN10 Request Login. You will manually enter the code for the function.

5.  Write the RDML Code to request the field iiiLOGIN.  (This example does not include any field/file level validation.  You could include validation routines inside the RDML to validate the login.)

     One possible solution to this exercise is shown below (where iii is your course assigned ID): 

FUNCTION  (*DIRECT *WEBEVENT)
REQUEST   FIELDS((#iiiLOGIN)) EXIT_KEY(*NO) MENU_KEY(*NO) USER_KEYS((01 SUBMIT))

 

  

6.  Exit and save your RDML function.

7.  Compile your functions.

8.  Using the LANSA HTML editor, register the keywords to link your iiiFN10 Request Login function to your iiiFN007 Display Sections in Department function

     The keyword entries are specified as follows (where iii is your course assigned ID):

Process

iiiPROC04

Function

iiiFN10

Keyword

SUBMIT

Description

Login

Linked Process

iiiPROC03

Linked Function

iiiFN07

 

  

9.  Working with your iiiPROC03 process, manually edit your function iiiFN07 so that it checks the value of iiiLOGIN. If the value is blank, then the iiiFN10 login function should be called. Your modified function might appear as follows (where iii is your course assigned ID):

FUNCTION  OPTIONS(*DIRECT *WEBEVENT)
GROUP_BY  NAME(#HEADER) FIELDS((#iiiDEPT) (#DEPTDESC) (#RENTRY *HIDDEN)) 
DEF_LIST  NAME(#iiiLIST) FIELDS((#LISTDUMMY *HIDDEN) #SECTION #SECDESC #SECPHBUS)  
IF        COND('#iiiLOGIN *EQ *BLANKS')
CALL      PROCESS(*DIRECT) FUNCTION(iiiFN10)

ENDIF    
IF        COND('#RENTRY *NE Y')
...      

 

  

10.   Exit and save your RDML function.

11.  Compile your function.