[ |../../index.htm#lansa/frmeng01_0640.htm]
You are here:

Step 3. Add Form Logic

1.  Switch to the Source tab. Below the Define_Com statements, define four work fields as follows:
Define Field(#NewTotalSalary) Reffld(#iiiTotalSalary)
Define Field(#CurrentTotal) Reffld(#iiiTotalSalary)
Define Field(#ServerStatus) Reffld(#IO$STS)
2.  Copy and paste the working list definition Employees from function iiiFN21.
Def_List Name(#Employees) Fields(#xEmployeeIdentification #iiiFullName #xDepartmentCode #xEmployeeSalary #iiiNewSalary) Counter(#listcount) Type(*WORKING) Entrys(*MAX)
 
     The exchanged working list definition must be identical in the form and the called function.
CALL_SERVER_FUNCTION BIF
The CALL_SERVER_FUNCTION calls a function running on a server. In order to use this BIF, the application must have a client server connection with a server. This would usually be established when the user initially signs on to the application.
CALL_SERVER_FUNCTION can optionally pass the Exchange list of fields to the server function and receive the Exchange field list back. Up to 10 working lists can be exchanged with the server function.
     The CALL_SERVER_FUNCTION should use the following parameters:

WITH_ARGS

 

Server Symbolic Name

*sserver_ssn

Name of RDML function to be called

IIIFN21

Pass Current Exchange List

Y

Receive Exchange List back

*default

Working List 1

#Employees

TO_GET

 

Return Code

#ServerStatus

 |

     See the Technical Guide for more information on the Client Server built-in functions.
3.  Complete the SubmitButton.Click event routine, based on the following:
Use BEGINCHECK/FILECHECK/ENDCHECK to validate xDepartmentCode using table xDepartments
      Clear list Employees
      EXCHANGE fields xDepartmentCode and iiiPercent
      If *sserver_connected = N
          Call, process *direct, function iiiFN21, Pass list Employees
          else
          USE CALL_SERVER_FUNCTION, with arguments (*sserver_ssn iiiFN21 Y *default Employees) To Get(#ServerStatus)
      EndIf
      If (#ServerStatus *ne OK)
      Message 'Call server function failed'
      End if