Versions Compared

Key

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

...

3.      Your completed code should look like the following

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(484) Clientheight(150) Componentversion(2) Left(620) Top(175)
Define_Com Class(#DEPTMENT.Visual) Name(#DEPTMENT) Displayposition(1) Left(24) Parent(#COM_OWNER) Tabposition(1) Top(17)
Define_Com Class(#SECTION.Visual) Name(#SECTION) Displayposition(2) Left(29) Parent(#COM_OWNER) Tabposition(2) Top(46)
Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Create') Displayposition(3) Left(291) Parent(#COM_OWNER) Tabposition(3) Top(23)
Define_Com Class(#PRIM_STBR) Name(#StatusBar1) Displayposition(4) Height(28) Left(0) Messageposition(1) Parent(#COM_OWNER) Tabposition(4) Tabstop(False) Top(272) Width(476)

Evtroutine Handling(#com_owner.CreateInstance)

Set Com(#com_owner) Caption(*component_desc)

Endroutine

Evtroutine Handling(#Button1.Click)
Begincheck
Filecheck Field(#SECTION) Using_File(SECTAB) Using_Key(#DEPTMENT #SECTION) Msgtxt('Department/Section not found')
Filecheck Field(#SECTION) Using_File(PSLMST1) Using_Key(#DEPTMENT #SECTION) Msgtxt('No employees for this department/section')
Endcheck

* Call JSM function to create Excel
Exchange Fields(#DEPTMENT #SECTION)
Call Process(*DIRECT) Function(iiifn12)

Endroutine
End_Com

4.      Compile your form.                 Test

Test your Create Excel application. Remember your document will be written to the training subdirectory of the JSM Instance. If necessary, create the folder…/jsm/instance/training.

...

Open your document in Excel. It should look like the following:

Image Added   

Note

...

Note: If you are using the JSM Server on an IBM i server you will need to map a drive to folder /training. If you are using a local JSM Server the folder will be \JSMInstance\training.

5.      If you have problems, remember you can use debug to follow your program logic. You could also start the ExcelService with trace and check the trace files. To do this add TRACE(*YES) to SERVICE_LOAD of the ExcelService.

     #jsmxcmd := 'SERVICE_LOAD SERVICE(ExcelService) TRACE(*YES)'